2
votes

Before I get comments saying this is a duplicate, I looked, found similar questions but their respective answers didn't work for me.

I currently have a simple batch script to refresh explorer.exe (related to this question) and have exit at the end. The script works but the command window doesn't close. Looking at other questions, people had suggested using exit/b. Tried that as well and it had the same affect as the former.

My full code can be found in the link above but I will also post here.

@echo off
cls
taskkill /f /im explorer.exe >nul
timeout 1 /nobreak >nul
explorer.exe
exit
1

1 Answers

2
votes

Use start explorer.exe so that explorer is launched on its own thread and not using the command window thread. As it is now, by just calling the application from the script, you are telling the command window to wait until explorer is exited before continuing.