Skip to content

Instantly share code, notes, and snippets.

@paveljurca
Last active July 17, 2017 10:44
Show Gist options
  • Save paveljurca/e92d1b99b6e1811c01f2a9878a07d70f to your computer and use it in GitHub Desktop.
Save paveljurca/e92d1b99b6e1811c01f2a9878a07d70f to your computer and use it in GitHub Desktop.
Restart Explorer.exe context menu

Restart Explorer.exe context menu

Following creates a "Restart Explorer.exe" context menu (doing right click on Desktop). If you wonder what the /v:on switch does, it turns on Delayed Expansion which by default is turned off. It does expand %WINDIR% at the execution time.

reg add "HKCR\Directory\Background\shell\Restart Explorer.exe\Command" /ve /d "cmd /v:on /c """taskkill /f /im explorer.exe ^& start ^!windir^!\explorer.exe""""

Pro Tip

While CMD.exe is a command-line interpreter (CLI), EXPLORER.exe is a Windows shell. It runs system's search or File Type associations meanwhile being a file manager.

It could be called soft restart.

taskkill /f /t /im explorer.exe & %windir%\explorer.exe

Problems with GUI are: C:\WINDOWS\explorer.exe missing, or C:\WINDOWS\System32\shell32.dll corrupted (stores icons etc.), not to confuse with RunDLL32.exe.

, or it takes parameters without starting GUI at all. In that case there's no desktop, taskbar, icons or WIN keyboard shortcuts working.

There's just one explorer.exe for all logged users, so killing it kills it for all locked users on the station.

Can take parameters (http://www.geoffchappell.com/studies/windows/shell/explorer/cmdline.htm)

explorer file.doc opens file with a default program.

explorer . opens window at the current folder.

explorer , opens window at the Computer

runas /netonly /noprofile /user:PC001\user "explorer \\PC001\Data\" which sadly does not work because the credentials used to connect to the network share are different from the credentials used to start the program.

more objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment