15

This is for Windows 10.

Is there a way to replace explorer.exe with, for example, a powershell script?

I'm looking to start a custom shell application without having to have explorer.exe run in the background or handle the startup of those items.

EDIT: Since I'm getting down voted... I was capable of doing something similar in Windows Embedded 7 Standard. I added a key called Shell to

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System

The key added there had Powershell.exe with command line options to execute script silently. There I was able to execute my custom shell.

This does not work with Windows 10.

0

2 Answers 2

15

This is stored in the key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell

Replace this with whatever you want, but the software it loads in place will then need to provide a way to log out/shut down/restart the machine, or you'll need to use Task Manager to do so.

11
  • I tried this, however my tablet got bricked. Windows 10 Pro 1607. Need to custome shell a classic windows app, W10Pro admits just UWA. How dis you use your proposed answer?
    – digitai
    May 2, 2017 at 21:26
  • What is the task manager executable path in windows 10 pro?
    – YumYumYum
    Oct 17, 2019 at 21:05
  • 1
    This doesn't show you how to set a shell for a specific user though, which is what the OP appears to ask (given his use of HKEY_CURRENT_USER)
    – komodosp
    Mar 18, 2020 at 16:22
  • Never try this on your normal user account, create a new account to do it. As for "bricking", OF COURSE it will cause problems if you do this to the only account you can log on with, and make a mistake in the path or filename, or if you set it to an application that doesn't allow you to reverse the change. But even then it won't brick your machine, you can still Ctrl+Alt+Del into task manager, and start explorer.exe from there to get the good old UI back.
    – Luc VdV
    Apr 29, 2021 at 12:38
  • @LucVdV since the key is under HKLM, adding another account won't help, will it?
    – Tom
    Oct 14, 2021 at 11:04
3

This is how I've been doing it for years, from Windows NT4 on to Windows 10 and Server 2019.

It is best to change Windows Explorer's settings to show file extensions, so you don’t select ‘ntuser.dat.log’ or ‘ntuser.ini’ or another wrong file below.

  1. Create a new user, let’s say ‘Test’.
  2. Log on as that user, so the first logon agent is executed, creating the profile directory and registry hive.
    Log off again, and log back into your normal account (or any account that is member of the Administrators group).
  3. Make sure the user account you just logged out of is not logged in – neither at the console, nor remote desktop, nor any scheduled tasks that may be active under this account, during the remainder of this procedure.
  4. Open regedit, and select HKEY_USERS.
  5. Menu File / Load Hive.
    Navigate to C:\Users\{new user name} -- C:\Users\Test in my example
    Select the file ‘NTUSER.DAT’ and load it.
  6. You will be prompted to enter a key name. Just invent one, the user’s registry hive will be loaded under that name as a new branch in HKEY_USERS. I used ‘Test’ here.
  7. Go to HKEY_USERS\Test\Software\Microsoft\Windows NT\CurrentVersion\Winlogon
    Create a new String value, named Shell.
    Set it to the application you want to start instead of the normal Windows shell.
    Specify the full path, make no assumptions about PATH environment variables etc., as far as I could figure out there is no environment yet when Windows reads this key.
    I used ‘C:\Windows\system32\cmd.exe’ in the example below.
    This works with explorer.exe without path, so I think Windows will search the C:\Windows directory – but I’m not sure, because it will also launch explorer.exe if you leave the setting empty or specify a non-existing file.
  8. Important
    Now go back to HKEY_USERS\Test, and unload that hive (menu File / Unload Hive, and confirm).
    If you skip this step and leave it loaded, the entire user profile including its registry hive will be re-created under a new name (C:\Users\Test.1 or similar) the next time you log on as that user, and your changes will be lost.
    Windows 10 and later Server systems seem to be more permissive here than older versions, but I would take no risk.
  9. Now just log off, and log on as Test.

This is how the result looks in the Server 2019 VM under VMWare where I just ran through this procedure to make sure I skipped no steps: Result screenshot

Some things to keep in mind when you create your shell program:

  • Your custom shell will start in C:\Windows\system32\ as working directory, even if your exe is located somewhere else.
    If you created a plain user account (non-admin), it will not have write access there, so best 'cd' to somewhere else early, if you expect your app to write log files or so in its working directory.
  • When your application exits (or crashes), it will not log you out – you’ll be left with an empty black screen.
    In cmd.exe, for example, log off by issuing the ‘logoff’ command (C:\Windows\system32’\logoff.exe).
  • Some functionality you may expect to be available in a custom app you wrote in C# or so, will not work because it is provided by explorer.exe.
    It may not work and just give an error, or it may launch explorer.exe.
  • If you launch explorer.exe (for example by typing ‘explorer’ at the command prompt in the example), the first instance will not show up as the explorer window you would expect. The normal Windows desktop, task bar etc. will appear instead.
  • Don’t think users will never discover ways to still get to the classic desktop, even if you block ctrl+alt+del or delete the task manager executable.
    One trick users of my kiosk app discovered > 20 years ago, way back under Windows NT4: remove all paper from the printer, and start a print job from within my app. The "out of paper" error message that was issued by the (HP) printer driver contained a Help button. In the help file that opened, one of the pages contained a link to open the Printers control panel. Control panel is just another instance of explorer.exe. A bit later, shop attendants were browsing the web on the kiosk.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.