Link to home
Start Free TrialLog in
Avatar of Luis Diaz
Luis DiazFlag for Colombia

asked on

AutoHotkey: close all active windows explorer

Hello experts,
I am looking for an AutoHotkey that allows me to close all windows explorer windows (active, and minimized one's).
If you have advice on this please let me know.
Thank you for your help.
ASKER CERTIFIED SOLUTION
Avatar of Joe Winograd
Joe Winograd
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In case you'd like to try PowerShell:
$app = New-Object -COM 'Shell.Application'
$app.Windows() | foreach { $_.Quit() }

Open in new window

Hi Sam,
I know very little about PowerShell. What in that code tells it to close (Quit) only Windows/File Explorer windows? The only things that I can see in the code that might do it (again, knowing little about PowerShell) are the .Windows and Shell.Application references, but I presume that would catch more than just Windows/File Explorer. What's the scoop? Thanks, Joe
Avatar of Luis Diaz

ASKER

Thank you Joe, I tested and it works!
Glad to hear it, Luis, thanks for letting me know. Regards, Joe
Hi Joe,

My apologies ... you are absolutely correct ... the snippet should include a test for Windows Explorer:

$app = New-Object -COM 'Shell.Application'
$app.Windows() | foreach { if ($_.FullName -match ('EXPLORER.EXE$')) { $_.Quit() } }

Open in new window

Thanks,
Sam
Thanks for the update, Sam...much appreciated! Regards, Joe