Exiting Windows 98 Automatically using a Batch File
You can use either of the following commands in a batch file to restart Windows 98 Automatically:
runonce.exe -q rundll32.exe shell32.dll,SHExitWindowsEx n
Where n is one, or a combination of the following numbers:
- 0 – LOGOFF
- 1 – SHUTDOWN
- 2 – REBOOT
- 4 – FORCE
- 8 – POWEROFF
The above options can be combined into one value to achieve different results.
For example, to restart Windows forcefully, without querying any running programs, use the following command line:
rundll32.exe shell32.dll,SHExitWindowsEx 6
NOTE: Using the FORCE option can cause programs to lose data.
The Following is an explanation of each available option used with the above command:
- LOGOFF – Shuts down all running processes, then logs the user off.
- POWEROFF – Shuts down the system and turns off the power. The system must support the power-off feature.
- REBOOT – Shuts down the system and then restarts the system.
- SHUTDOWN – Shuts down the system to a point at which it is safe to turn off the power. All file buffers have been flushed to disk, and all running processes have stopped.
- FORCE – Forces processes to terminate. When this flag is set, Windows does not query running applications to inform them that Windows is shutting down. This can cause the applications to lose data, therefore, you should only use this flag in an emergency.
The “rundll32.exe shell32.dll,SHExitWindowsEx (n)” command mentioned above can be called from the RunOnce registry key.
The runonce.exe -q command mentioned above restarts the computer after a 15 second delay. There are no other options when using this command line, and it cannot be called from the RunOnce registry key.