15

I need a batch file to stop and restart explorer.exe, but I don't know all the commands needed. I know if you select it from the task manager you can restart it, but I want a file on my desktop I can double-click. I'm using Windows 10 Professional.

0

2 Answers 2

30

Pretty simple to do this and pretty self-explanatory:

taskkill /im explorer.exe /f
start explorer.exe
exit

The /im makes it look for a process name. /f says to kill it forcefully, however your force is as powerful as the permissions you have.

4
  • thank you - it worked :D although the timeout command isn't necessary :/ Aug 30, 2017 at 5:23
  • 1
    also, explaining what each command does and why the flags used are necessary could help a future viewer of this question with a similar but not identical problem Aug 30, 2017 at 6:56
  • 1
    Also adding timeout or pause command in between taskkill and start commands will give some time to restart.
    – Biswapriyo
    Aug 30, 2017 at 7:31
  • 1
    Nice! I created a shortcut with this target: C:\Windows\System32\cmd.exe /c taskkill /im explorer.exe /f & start explorer.exe - bonus, you can assign this shortcut a hotkey to trigger it quickly and easily similar to how Ctrl + Alt + Backspace restarts the X server in Linux.
    – Merritt
    May 28, 2021 at 14:28
5

To restart Explorer in Windows 10, I created a shortcut with the Target:

powershell -command "gps explorer | spps"

gps is the Alias for Get-Process

spps is the alias for Stop-Process

You must log in to answer this question.

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