How to Restart Explorer Cleanly Using Shortcut or Command-line

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.

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

A 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 kill the Explorer shell without letting it complete its work.

Restart Explorer Cleanly 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 — i.e., letting it 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, 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]

[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.

One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support. It won't take more than 10 seconds of your time. The share buttons are right below. :)

Ramesh Srinivasan is passionate about Microsoft technologies and he has been a consecutive ten-time recipient of the Microsoft Most Valuable Professional award in the Windows Shell/Desktop Experience category, from 2003 to 2012. He loves to troubleshoot and write about Windows. Ramesh founded in 2005.

Leave a Comment