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.
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:
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 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\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.
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!
About the author
Ramesh Srinivasan founded Winhelponline.com back in 2005. He is passionate about Microsoft technologies and he has been a Microsoft Most Valuable Professional (MVP) for 10 consecutive years from 2003 to 2012.