首先,你需要知道是什么检查打开的psd文件(市面上有很多pdf阅读器),只有知道是哪个程序打开的,才知道要杀什么进程。 假设你已经知道是什么程序打开的pdf,那你只要尝试修改文件,如果修改失败,则查询系统当前运行的进程,找到该进程,调用kill函数就可以了。
[quote=引用 4 楼 shingoscar 的回复:] 或者 openfiles /disconnect /op "xxxx.pdf" 需要管理员权限
openfiles /disconnect /op "xxxx.pdf"
或者 openfiles /disconnect /op "xxxx.pdf" 需要管理员权限
Process[] procs = Process.GetProcessesByName("pdf"); foreach (Process pro in procs) { pro.Kill();//杀掉进程 } 百度一搜就有了
openfiles /query|find "xxxx.pdf"
110,561
社区成员
642,566
社区内容
加载中
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧