Way*_*e Z 4 powershell explorer powershell-2.0
我正在编写以下代码以使用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打开窗户.
有人能帮忙吗?
CB.*_*CB. 12
我认为管道中出现了一些问题.此代码有效:
$a = (New-Object -comObject Shell.Application).Windows() |
? { $_.FullName -ne $null} |
? { $_.FullName.toLower().Endswith('\explorer.exe') }
$a | % { $_.Quit() }
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3006 次 |
| 最近记录: |