I am writing the following code to close all explorer windows with PowerShell:
(New-Object -comObject Shell.Application).Windows() | ? { $_.FullName -ne $nu
I think there's something in the pipeline that goes wrong. This code works:
$a = (New-Object -comObject Shell.Application).Windows() | ? { $_.FullName -ne $null} | ? { $_.FullName.toLower().Endswith('\explorer.exe') } $a | % { $_.Quit() }