我正在编写以下代码以使用PowerShell关闭所有资源管理器窗口:
(New-Object -comObject Shell.Application).Windows() |
? { $_.FullName -ne $null} |
? { $_.FullName.toLower().Endswith('\explorer.exe') } | % { $_.Quit() }
Run Code Online (Sandbox Code Playgroud)
但它没有关闭所有打开的窗户.相反,它只关闭RoundDown(N/2)+1窗口,并RoundUp(N/2)-1打开窗户.
有人能帮忙吗?