Отключение из файла bat * без * закрытия процесса подтверждения в Windows 95

1146
SCO

Каждое руководство в сети говорит об использовании RUNDLL USER.EXE, ExitWindows, который работает ... из команды запуска

Однако при запуске из файла bat эта команда, хотя и работает, запрашивает подтверждение, чтобы убить «оставшиеся» процессы. Этот процесс является самой строкой cmd. Я не смог вызвать его с помощью CALL, но так как call создает новую командную строку, я ожидаю, что результат будет таким же.

Это только вопрос Windows 95, это для виртуальной машины для автоматического выключения после запуска приложения. Основная идея заключается в том, чтобы в папке «Автозагрузка программ» был скрипт, который запускает приложение, ждет, пока оно не закроется с помощью START / WAIT, а затем использует что-то для автоматического выключения окон.

1

4 ответа на вопрос

1
bill

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.

0
Zoredache

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.

Я знаю, но я попробовал это. Запустите RUNDLL USER.EXE, ExitWindows, а затем EXIT (это одно из тех надоедливых постоянных окон), похоже, ничего не делает. Я также пробовал варианты на основе синтаксических примеров, которые я нашел: «Пуск», «RUNDLL USER.EXE, ExitWindows», «Пуск», «RUNDLL USER.EXE, ExitWindows и т. Д.». SCO 8 лет назад 0
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.

Просто обратите внимание, что Win95 зависит от * совместной * многозадачности, и могут быть случаи, когда он не может завершить работу во время выполнения процесса. DrMoishe Pippik 8 лет назад 0
@ drmoishe-pippik: Windows 95 использует совместную многозадачность ** только ** для 16-битных процессов. Кроме того, проблема блокировки выключения относится только к процессам, которые не отвечают на сообщения WM_QUERYENDSESSION и WM_ENDSESSION своевременно. 8 лет назад 0
Ммм ... В Windows 95 не было вытесняющей многозадачности ... NT была первой системой MS, которая сделала это. DrMoishe Pippik 8 лет назад 0
@DrMoishe Pippik: NT была первой ОС Microsoft, которая сделала это, да. И это было ** до ** Windows 95, 28 июля 1993 года. Несмотря на это, [Windows 95 действительно поддерживала вытесняющую многозадачность только для 32-разрядных процессов] (https://support.microsoft.com/en-us/kb/117567 ). 8 лет назад 0
0
Botmaster
%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

Я * почти уверен *, что в Windows 95 не было каталога `system32`, не говоря уже о shutdown.exe ... a CVn 8 лет назад 0
уверены ли вы? https://www.youtube.com/watch?v=QtUaOHPi3II Botmaster 8 лет назад 0