Latest posts by Michael Pietroforte (see all)
- Author and member of the year 2019 – Why DevOps still doesn't rule the IT world - Wed, Jan 1 2020
- Results of the 4sysops member and author competition in 2018 - Tue, Jan 8 2019
- Why Microsoft is using Windows customers as guinea pigs - Reply to Tim Warner - Tue, Dec 18 2018
In Windows 8, Microsoft renamed Windows Explorer to File Explorer. You might think that this implies that Explorer is no longer the default shell in Windows. However, naming decisions are often based on marketing goals. I think the point is that Explorer is no longer used to explore just Windows files but also files in the cloud.
That Explorer is the default shell in Windows essentially means that you use its GUI to start applications. Thus, often when you change Windows UI settings, such as forcing notification icons to always show or configuring the pinned programs on the taskbar, Explorer has to be restarted so that the changes take effect. Sometimes you will see a dialog window that suggests signing out of your computer to apply these changes.
The userinit process that launches after a user signs in initializes the user environment and then starts the default shell. For this reason, signing out and signing in again ensures that shell-related changes take effect. However, this prompt usually comes at the wrong time. Perhaps you opened multiple applications or web pages, and signing out would mean a lot of click-click to restore your current session. One option could be to just restart File Explorer.
Just closing File Explorer wouldn’t necessarily do the trick because the File Explorer process will continue to run. Several ways exist to restart File Explorer.
Exit File Explorer ^
The easiest way to shut down File Explorer is to press CTRL+SHIFT and then right-click the Windows taskbar. The last entry in the context menu is Exit Explorer. In Windows 7, you get the same option by holding CTRL+SHIFT and right-clicking the Start menu.
The result is that you no longer have a shell available even though all your applications will still be running. Perhaps this is the best way to learn what a shell is. The entire Windows UI will disappear, including the desktop and the taskbar, and you can’t even access the Start screen through the Windows key.
You’ll notice that the shell is quite essential, and you will want to have it back right away. All you have to do is start File Explorer. But how can you start a new process without a shell? This sounds like a question for a job interview where you have to prove that you know your Windows.
The answer is that you have to launch Task Manager—one of the few applications that can be launched in the absence of a shell. The fastest way is to press SHIFT+ESC; another option is the venerable CTRL+ATL+DEL. In Task Manager, you then click File > Run new task and enter explorer.exe. It might take a little, but then everything should be back to normal.
Starting explorer.exe in Task Manager
Windows shutdown dialog ^
Do you sometimes miss the old Windows shutdown dialog? I still use it every now and then when I want to close many applications before I turn off the computer. I just press ALT+F4 several times until all apps are closed and I reach the desktop. Pressing ALT+F4 one more time will make the old shutdown window appear. Simply clicking the desktop (without closing all your applications) and then pressing ALT+F4 will also do. If you now hold CTRL+SHIFT+ALT (don’t say piano lessons for IT pros don’t pay off) and then click Cancel, the File Explorer process will end and you are again without a shell.
The old shutdown dialog
You might wonder why the developer didn’t just add the Exit Explorer option to the dialog window. I think the answer is that at least one awkward key combination should be required if you do something as awkward as restarting your shell. The point is that this procedure is non-standard and you might run into all kinds of trouble. But that is why we love Windows. We have unlimited possibilities to make it crash. 😉
However, in most cases, you can just regain control of your Windows machine by restarting your shell as described above. Press CTRL+SHIFT+ESC to launch Task Manager and run explorer.exe as a new task.
The main advantage of this method is that you don’t need a mouse. Sometimes, when the shell crashes, the mouse no longer works, and the keyboard is your only option to restart File Explorer.
Task Manager ^
You can also just use the Task Manager right away to restart your shell. All you have to do is locate File Explorer on the Process tab, right-click it, and then select Restart.
Restarting File Explorer in Task Manager
This relieves you of the task of launching Task Manager and typing the file name after you restart File Explorer. It also has the advantage that File Explorer is restarted without delay, which reduces the risk of trouble for applications that depend on File Explorer.
The downside is that, if you have many processes running, you might have to scroll a little until you find File Explorer. This can be painful if you want to restart your shell when it hangs but the computer is awfully slow.
Command prompt ^
Yet another option is to restart File Explorer from a command prompt. Note that the command prompt doesn’t have to be elevated:
taskkill /F /IM explorer.exe
The F-switch forces the termination of the process. In most cases, you might not need it. “IM” stands for image name—just another term for the process name.
Despite the fact that some admins prefer to do everything they can at the command prompt, this method can be helpful if you need to restart the shell in a batch script to ensure that a newly deployed setting takes effect.
The same applies if you need to restart the shell in a PowerShell script:
Stop-Process -ProcessName Explorer
In contrast to the command prompt option, stopping File Explorer in PowerShell will restart the shell automatically. Doing so reduces the delay to a minimum.
Another advantage of using PowerShell is that it is the fastest way of all methods described here if you use the alias kill for Stop-Process. You can also restart your shell with this little PowerShell command:
kill -n explorer
PowerShell as default shell ^
Since PowerShell has the “shell” already in its name, it sounds natural to use it as an alternative to File Explorer. The userinit process uses a Registry key to check which application is configured as the default shell:
If you change the value of the key Shell from explorer.exe to powershell.exe, only the PowerShell prompt will be launched after you sign in.
Changing the default shell in the Registry
You can even apply what you just learned in this post and restart the shell without signing out. That is, if you restart File Explorer using one of the methods described above, your familiar Windows environment will disappear, and the PowerShell prompt will start. However, this works only once. If you then enter kill -n explorer.exe, PowerShell will tell you that it can’t find a process with this name.
PowerShell as the default shell
I’d say this is the ultimate environment for the real PowerShell geek. All those colorful windows of Windows will be gone, and this bloated GUI-based Windows shell will never hang again. And, if you really need one of those colorful GUIs, you can start it right from your new default shell. 😉
If you don't want to work with such a pale shell, but also don't like the default Windows shell, you might want to look at these coloful alternative shells for Windows.
Maybe I should mention that I don’t recommend using an alternative shell. I should also add that restarting File Explorer is a non-standard procedure and can cause all kinds of problems.