Shutdown from a bat file *without* close process confirmation in windows 95

1

Every single guide on the net says to use RUNDLL USER.EXE,ExitWindows which works... from the run command

However, when run from a bat file, this command, although it works, requests confirmation to kill the 'remaining' processes. That process is the cmd line itself. I haven't been able to call it with 'CALL' but since call creates a new command line i expect the result to be the same.

This is a windows 95 question only, it's for a virtual machine to auto shutdown after running a application. The idea is basically to have a script on the Startup programs folder that starts the app, waits until it exits with START /WAIT, then uses something to auto shutdown windows.

SCO

Posted 2015-08-05T22:03:23.457

Reputation: 11

Answers

1

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.

bill

Posted 2015-08-05T22:03:23.457

Reputation: 21

0

Try calling the above command with start should let you run it in the background, and not leave a cmd.exe waiting around. I don't know the 9x syntax off the top of my head but do a start /? at the command line.

Zoredache

Posted 2015-08-05T22:03:23.457

Reputation: 18 453

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

0

There are several automated shutdown methods for contemporary computers (see this link and this) but Windows 95 is so old that I they may not work. (Still, try your luck.) If all failed, I am afraid you only option would be to create one yourself; i.e. create a Windows 95 app that shuts down the computer.

user477799

Posted 2015-08-05T22:03:23.457

Reputation:

Just a note that Win95 depends on cooperative multitasking, and there may be occasions when it cannot shut down while a process is executing. – DrMoishe Pippik – 2015-08-06T04:23:26.240

@drmoishe-pippik: Windows 95 uses cooperative multitasking only for 16-bit processes. In addition, the shutdown blocking issue only applies to processes that do not respond to the WM_QUERYENDSESSION and WM_ENDSESSION messages in a timely fashion. – None – 2015-08-06T06:32:18.507

Umm... Windows 95 did not have preemptive multitasking... NT was the first MS system that did. – DrMoishe Pippik – 2015-08-07T04:27:17.240

@DrMoishe Pippik: NT was the first Microsoft OS that did it, yes. And it came before Windows 95, on 28 July 1993. Regardless, Windows 95 did support preemptive multitasking for 32-bit processes only.

– None – 2015-08-08T07:40:20.357

0

%windir%\System32\shutdown.exe -r -f

Adding -f forces system to shutdown or reboot. in windows 95, the path would be C:\Windows\Command referring to this website

Botmaster

Posted 2015-08-05T22:03:23.457

Reputation: 150

I'm pretty sure that Windows 95 did not have the system32 directory, let alone shutdown.exe... – a CVn – 2015-08-10T08:52:41.537

are you sure? https://www.youtube.com/watch?v=QtUaOHPi3II

– Botmaster – 2015-08-10T09:05:47.040