0

Now this may sound whimsical, but I want to know, can a batch script be made, that kills the Explorer.exe and it's child processes forcibly and then successfully starts the Explorer.exe process again, without having to run that Batch script again?

I tried the below code, but even after waiting for 10 mins, the Explorer.exe hasn't started yet, so I am afraid to add /T to the taskkill.

start /wait taskkill /IM explorer.exe /F
start "" explorer.exe /wait

How can I acheive something like this with batch script, in autonomous manner?

taskkill /IM /F Explorer.exe /T
start /wait Explorer.exe
7
  • 2
    This may be an XY problem. What makes you think that restarting explorer will make apps load faster?
    – DavidPostill
    Jan 23, 2020 at 21:11
  • 1
    The lag time required to restart Explorer is likely to exceed any time you might save
    – K7AAY
    Jan 23, 2020 at 21:13
  • What was the result of adding T? same thing?
    – Moab
    Jan 23, 2020 at 21:48
  • See if this helps>>>>>>>>superuser.com/questions/1245653/…
    – Moab
    Jan 23, 2020 at 21:50
  • 1
    PowerShell : Get-Process explorer | Stop-Process or gps explorer | spps Jan 25, 2020 at 18:41

2 Answers 2

0

start command starts programs in unusual ways. It is not something that is used normally. In help for start (start /?) it discusses how to start programs normally and with start.

taskkill /IM explorer.exe /F
start explorer

First line. Console programs always wait when started normally. To have them not wait you use start.

Second line. GUI programs don't wait when started normally except in batch files for compatibility reasons. As you don't want to wait for explorer use start to not wait.

Also if you Ctrl+Shift+Right click a blank spot on the taskbar you will get an Exit Explorer option which will shut explorer down gracefully. Press Ctrl+Shift+Esc to start Task Manager and File menu - Run New Task and type explorer.

-1

Do start /wait taskkill /IM explorer.exe /F then start /wait explorer It work's for me. NOTE: /wait will mean the command is never finished. Most programs are a child process of explorer meaning it can never fully start up.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .