close all open folders in file explorer

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
user124
Posts: 4
Joined: 20 Feb 2020 09:51

close all open folders in file explorer

#1 Post by user124 » 16 Mar 2020 17:05

Hi all,

I want to create a bat file that can close all open folders in the file explorer. However, it should not close any programs that are open (for example: excel, outlook, web browsers etc). Any help would be appreciated!

Thanks!

Eureka!
Posts: 89
Joined: 25 Jul 2019 18:25

Re: close all open folders in file explorer

#2 Post by Eureka! » 17 Mar 2020 08:01

What have you tried yourself? And where did that go wrong?

If you have Launch folder windows in a separate process enabled:

Code: Select all

taskkill.exe /im explorer.exe

If you have that setting disbaled:

Code: Select all

taskkill.exe /im explorer.exe /F & explorer.exe
The second command could also be used in the first case, but then does a lot of unneeded work.

(both commands are untested)

Post Reply