JSI Tip 0470 - How to launch a program before the shell (Explorer) starts.
March 27, 1998
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_MACHINESoftwareMicrosoftWindowsNTCurrentVersionWinlogonUserinit
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%System32DelTemp.bat
%SystemRoot%System32Userinit.exe
exit
where %SystemRoot%System32DelTemp.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.
About the Author
You May Also Like