File tree Expand file tree Collapse file tree 3 files changed +43
-1
lines changed
Expand file tree Collapse file tree 3 files changed +43
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ sidebar_position : 3
3+ ---
4+
15### Driver 驱动
26
37#### (1)Windows平台
Original file line number Diff line number Diff line change 1+ ---
2+ sidebar_position : 2
3+ ---
4+
5+ ### File occupancy 文件占用
6+
7+ #### (1)Windows平台
8+
9+ 虽然在自动升级时会关闭应用程序,如果出现特殊情况出现文件占用通常是进程还在运行导致的。这时候可以使用微软官方提供的handle.exe检测工具来查看指定目录下是否有进程在运行"handle.exe"是一款由微软提供的命令行工具,可以用来显示哪些进程打开了哪些文件。在C#中调用handle.exe,我们可以使用` System.Diagnostics.Process ` 类,如果检测到则会返回该目录下正在运行的进程列表。
10+
11+ ``` c#
12+ using System ;
13+ using System .Diagnostics ;
14+
15+ class Program
16+ {
17+ static void Main ()
18+ {
19+ Process process = new Process ();
20+ process .StartInfo .FileName = " handle.exe" ;
21+ process .StartInfo .Arguments = " filename" ;
22+ process .StartInfo .UseShellExecute = false ;
23+ process .StartInfo .RedirectStandardOutput = true ;
24+ process .Start ();
25+
26+ string output = process .StandardOutput .ReadToEnd ();
27+ Console .WriteLine (output );
28+
29+ process .WaitForExit ();
30+ }
31+ }
32+ ```
33+
34+
35+
36+ 参考资料:
37+
38+ - https://learn.microsoft.com/zh-cn/sysinternals/downloads/handle
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v Cons
7373
7474
7575
76- 参考内容 :
76+ 参考资料 :
7777
7878- https://learn.microsoft.com/zh-cn/windows/security/application-security/application-control/user-account-control/how-it-works
7979- https://blog.walterlv.com/post/windows-user-account-control.html
You can’t perform that action at this time.
0 commit comments