小编Way*_*e Z的帖子

在PowerShell中关闭所有资源管理器Windows

我正在编写以下代码以使用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打开窗户.

有人能帮忙吗?

powershell explorer powershell-2.0

4
推荐指数
1
解决办法
3006
查看次数

标签 统计

explorer ×1

powershell ×1

powershell-2.0 ×1