If you set your program as the shell instead of explorer then it will autorun and windows will shutdown when the program exits.
From a post I made in 2001
Copy it to c:\windows. If you edit c:\windows\system.ini
and change
shell=explorer.exe
to
shell=progman.exe
then your computer will start in win3.11 interface mode.
From my 15 year since last updated web site http://www.mvps.org/serenitymacros
Exiting Windows
The first three sections are from Tweak95 available on the downloads page. The fourth section is changes with Win98.
Shut Down Windows
A command to exit Windows 95. This can only be used to shutdown, not restart or exit to msdos. To exit to msdos type ExitToMsDos which runs the Pif file of the same name. Place command in a shortcut or batch file.
C:\WINDOWS\RUNDLL32.EXE user.exe,ExitWindows
Restart Windows
To restart Windows copy Exit To Dos.pif (the pif part is hidden) and copy and rename it to Restart Windows. Edit the Program Sheet in the properties Change the command line to:
C:\WINDOWS\command.com /C exit
Make sure Close On Exit is checked. On the Advanced dialog check Use Current MSDos Configuration to exit and restart Windows without rebooting. Check Warn Before Entering MSDos Mode if confirmation is required before exiting and restarting. MSDos Mode must be checked.
An alternative way is to use the ExitWindowsExec function. This exits to MSDos to run a program, but as no program is given Windows restarts. Tpye into a shortcut or Start - Run dialog box.
C:\WINDOWS\RUNDLL.EXE user.exe,ExitWindowsExec
Shut Down Dialog Box
This reg file will set the default choice in the Shut Down dialog box. Windows 95B and IE4 remember the last setting chosen, so to set the default for these versions (rather than the last action) add the following command line to C:\Windows\Winstart.bat
(create Winstart.bat
if necessary). Remember to use the short filke name.
Regedit C:\<Path to Reg File>\ShutDown.Reg
Or this command line to a shortcut and put it in the StartUp folder.
Regedit /s C:\<Path to Reg File>\ShutDown.Reg
REGEDIT4
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer]
'1=first choice in dialog box, 2=second choice, ect.
"Shutdown Setting"=dword:00000001
Via the SHExitWindowsEx
Using the User.exe & User32.dll Exit Windows functions doesn't allow any control over what type of shutdown is preformed as parameters aren't passed, they operate as if 0 is passed - which is shutdown for ExitWindows and Logoff for ExitWindowsEx. An undocumented function SHExitWindowsEx in Shell32.dll which is what Explorer seems to use does take parameters.
rundll32.exe shell32.dll,SHExitWindowsEx [optional number in hex]
Action Value in Hex
EWX_LOGOFF 0
EWX_SHUTDOWN 1
EWX_REBOOT 2
EWX_FORCE 4
EWX_POWEROFF
for machines that turn off their own power 8
These values can be added together, eg, 5 is shutdown and force applications to close and an implicit logoff.
Note their is no Restart without rebooting. This requires a parameter of 42 (hex) to be passed to ExitWindows in User.exe. This can't be done from the command line. See tip above for a work around.
I know, but i tried that. Start RUNDLL USER.EXE,ExitWindows followed by EXIT (it's one of those pesky permanent windows) seems to do... nothing. I also tried variations based on the syntax examples i found: Start "" "RUNDLL USER.EXE,ExitWindows", Start "" RUNDLL USER.EXE,ExitWindows etc. – SCO – 2015-08-06T05:20:59.543