Restart Explorer Gracefully Using Shortcut or Command

When you make changes to the Windows registry using the Registry Editor, script or any other automation tool, you may have to logoff and login back for the changes to take effect.

That’s especially true if you’re altering the UI element metrics or changing the shell namespace folder icons etc. — as Explorer caches these settings when you log in.

And, some of the settings like desktop icons position and Taskbar preferences are written to the disk only at log off.

Exit Explorer – Hidden menu option

Other than logging off and logging in back again, another way to immediately apply the changes is to exit Explorer using a hidden menu option which Microsoft added in Windows 7 and higher. And then start a new Explorer.exe instance using Task Manager. See how to exit Explorer and restart it, a graceful exit method.

restart explorer gracefully

How to Exit Explorer and Restart Explorer in Windows 10 and Windows 8?

Graceful restart of the Explorer shell means that the settings such as desktop icons layout, Taskbar preferences, etc. will be saved when Explorer exits. Whereas, forcibly terminating explorer.exe processes using Task Manager (End Process), Taskkill.exe or Tskill.exe abruptly kills the Explorer shell without letting it complete its work.

Restart Explorer gracefully using NirCmd shortcut

If you’ve been using the “Exit Explorer” hidden context menu option very often, then check out the NirCmd utility. The advantage of using NirCmd being, you can create a shortcut and assign a hotkey to it, and optionally add it to the context menu for quicker access.

If you’re not already using NirCmd, an excellent automation tool from Nirsoft, download the portable application from the author’s site and extract NirCmd.exe to a folder.

Create a shortcut with the following command-line, prefixing the drive-letter and folder path where NirCmd.exe resides. Customize the shortcut icon as desired:

nircmd.exe restartexplorer

restart explorer gracefully

Double-clicking the shortcut terminates Explorer in a recommended way — allowing it to save your settings and automatically exit when it’s done. It then waits for a couple of seconds and starts a new Explorer shell.

Add “Restart Explorer” to the right-click menu

You can add a “Restart Explorer” command to the right-click menu. Download restart-explorer-context-menu.zip, unzip and run the enclosed REG file.

Alternatively, to make the REG file of your own, copy the following lines to Notepad and save the file with a .REG extension. Double-click the file to run it.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\DesktopBackground\Shell\Restart Explorer]
"icon"="explorer.exe,0"
"Position"="top"
"Extended"=""

[HKEY_CLASSES_ROOT\DesktopBackground\Shell\Restart Explorer\command]
@="nircmd.exe restartexplorer"

The above registry setting assumes nircmd.exe is located in a folder which is included in the PATH, such as Windows, Windows\System32 etc. If not, add the complete path to Nircmd.exe accordingly in the REG file.

Hold the SHIFT key down and right-click an empty area on the desktop. You’ll see the Restart Explorer command.

restart explorer gracefully

Want to make own “Exit Explorer” tool that doesn’t automatically restart Explorer? You can use the code sample at Stack Overflow. Gracefully Exit Explorer (Programmatically). RestartManager API (Vista and up) may be a better option though.

About the author

Ramesh Srinivasan founded Winhelponline.com back in 2005. He is passionate about Microsoft technologies and has a vast experience in the ITeS industry — delivering support for Microsoft's consumer products. He has been a Microsoft MVP [2003 to 2012] who contributes to various Windows support forums.

Leave a Comment

+1
Share
Tweet
Share
Pin