Skip navigation

JSI Tip 0470 - How to launch a program before the shell (Explorer) starts.

In tip 074, I explained how to change the Shell for selected users.

Using the same technique, you can launch an application before the Shell, so as to avoid any interaction with it.

Leaving the Shell as Explorer.exe, edit:

HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\CurrentVersion\Winlogon\Userinit

Double-click Userinit and change the string which begins with USERINIT,NDDEAGNT.EXE..... to YourOwn.exe,NDDEAGNT.EXE..... or YourOwn.bat,NDDEAGNT.EXE.....

Place your EXE or BAT file in the %SystemRoot%\System32 directory.

Since USERINIT is responsible for executing the shell program, you must start it yourself at the end of your program or batch file.

Explorer.exe is the standard shell in Windows NT 4.0. It can operate in either of two modes:

Browser mode
Shell mode (to manage the desktop, taskbar, and Start button)

When USERINIT launches Explorer.exe, Explorer.exe checks that no instances of Explorer.exe are running and that it is the Shell. If both conditions are true, it starts in shell mode.

Example: (we changed the registry entry to USERINIT.BAT,NDDEAGNT.EXE.....)

@echo off
REM JSI USERINIT.BAT
call %SystemRoot%\System32\DelTemp.bat
%SystemRoot%\System32\Userinit.exe
exit

where %SystemRoot%\System32\DelTemp.bat contains:

@echo off
RD /q /s C:\Temp
MD C:\Temp

Note: Don't use an Exit command in any called batch file.

Your EXE or BAT file will execute without any interaction with the Shell.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish