Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Restarting Explorer

Hello,

Every time I try to run a script that restarts explorer it successfully shuts down Explorer but afterwards does not come back.

I've tried,

Taskkill /IM explorer.exe /F&&explorer.exe

and

Taskkill /IM explorer.exe /F

explorer.exe

and

Taskkill /IM explorer.exe /F

explorer

and

Taskkill /IM explorer.exe /F

start explorer.exe

and

Taskkill /IM explorer.exe /F

start c:\windows\system32\explorer.exe

Nothing seems to kick off explorer except going to the system manually opening run from task manager and typing "explorer"

What am I doing wrong?

0

Comments

9 comments
Date Votes
  • It could be having a problem because it's trying to start explorer too soon after killing it. Try adding a pause in between:

     

    taskkill /im explorer.exe /f

    timeout /t 3 /nobreak

    start explorer.exe

    0
  • This is the output I received,

    SUCCESS: The process "explorer.exe" with PID 4320 has been terminated.
    ERROR: Input redirection is not supported, exiting the process immediately.

    0
  • From your error it looks like the startup process is trying to startup explorer while it's still in the process of shutting down.

    The timeout suggested by Luke above should work for you.

    0
  • When I tested my suggestion I got the same input redirection error as Anthony. When I took out the timeout portion that error went away. I'm not sure why it's having an issue with that, maybe try taking out the /nobreak switch?

    0
  • Got the same error when taking out /nobreak

    SUCCESS: The process "explorer.exe" with PID 7720 has been terminated.
    SUCCESS: The process "explorer.exe" with PID 7612 has been terminated.
    ERROR: Input redirection is not supported, exiting the process immediately.

    0
  • What? No powershell?

     

    Get-Process explorer | Stop-Process

    This kills explorer on my machine, and it instantly recovers when it quits.

    1
  • That's weird, I'll see if I have a chance to test some stuff later this afternoon.

    0
  • Oh wait, just realized you are talking about Explorer and not Internet Explorer. DOH!

    Powershell for the win! :-)

    0
  • Yes, is PowerShell an option? You should just be able to do this command in PowerShell, which I confirmed as working on Windows 10 1709 x64 but might not work on W7:

    stop-process -ProcessName explorer

    It also automatically starts the process again afterward.

    0