Create Simple Script to Close and Restart Explorer Automatically in Windows

Many times we need to log off or restart Windows to apply the changes made by a registry script or software. Sometimes we can avoid the log off or restart by doing a simple "End Task" of Windows Explorer and restart Explorer using Task Manager as mentioned in following tutorials:

But doing End Task and restarting Explorer using Task Manager requires a few manual steps. Wouldn't it be great if you can get a simple shortcut on Desktop or Quick launch toolbar and simply click on it to automatically end task and restart Explorer?

Today in this tutorial, we are going to share a simple Batch script which can end task of Explorer and then restart it automatically.

Simply copy paste following code in NOTEPAD and save the file with name "Restart_Explorer.bat" (including quotes):

@ECHO OFF
echo.
echo.
echo Simple Script to Restart Windows Explorer
echo.
echo Created by "Vishal Gupta" for AskVG.com
echo.
echo.
echo STEP 1: Closing Explorer . . .
echo.
TASKKILL /F /IM explorer.exe
echo.
echo.
echo STEP 2: Starting Explorer . . .
start explorer.exe
echo.
echo SUCCESS: Explorer is running.
echo.
echo.
PAUSE

That's it. You can place this script at any location like Desktop, Quick Launch toolbar and whenever you need to restart Explorer, simply run the script.

PS: If you don't want to create the script manually or face any problem while creating the script, you can download a ready-made script using following link:

Download Link

Also check:





Share this article: Facebook | Twitter | Google+ | Reddit | Tell a friend

Posted in: Windows 7, Windows 8 / 8.1, Windows Vista, Windows XP


Other similar articles that may interest you


Comments

  • M. GUPTA ... the king !!

  • Thanks for the script. Just what I was looking for.

  • Hey, thanks for posting this up. Great little script that's been really useful for me. It's saved me having to do a lengthy restart on several occasions now.

    I sometimes get a problem in Windows 7 where windows explorer just suddenly stops auto refreshing any file changes I make (copy paste etc) and the only solution was always a full restart of my system.

    Now I just run this little script instead and 2 seconds later all is working again.

    Thanks a lot :)

  • Not work for XP ;[

  • You can actually name the file whatever you want so long as you put ".bat" at the end of it (not including quotes). You can also replace "PAUSE" with "exit" at the very end of the script to have it automatically close the command prompt. :p

  • Very clean. Much faster than another script I found on the web. Thanks a lot!

  • hi
    thanks for your trick. after restart explorer the new black window will be opened. how to close this windows then?

  • hi i replaced "PAUSE" with "exit". my problem is resolved.
    thanks for dxsyndicate

  • can the script change to Script to Close and Restart outlook Automatically in Windows..please help

  • THanks

  • I have a VB6 application, which when it starts, closes the windows explorer and relaunches it before it exits.

    The code that worked perfectly till Windows 8 is this..

    Const WM_QUIT As Long = &H12
    Const WM_QUIT_WIN As Long = &H5B4
    //For Windows 7
    lngHandle = FindWindow("Shell_TrayWnd", vbNullString)
    If lngHandle 0 Then
    PostMessage lngHandle, WM_QUIT_WIN , 0, 0
    End If

    //For XP
    lngHandle = FindWindow("Progman", vbNullString)
    If lngHandle 0 Then
    PostMessage lngHandle, WM_QUIT, 0, 0
    End If
    The same code however fails to close explorer in Windows 10. It does sometimes close the explorer but then it restarts. Closing the explorer is not consistent in its behavior.

    Is there any thing that has changed in Windows 10 which prevents the messages to close the explorer.

    Any help would be appreciated. Thanks in advance.

  • Dont work in 64bit windows!

    but it works:

    taskkill /f /im explorer.exe
    start "" "%windir%\explorer.exe"

Leave a Comment

(required)