How Windows 98 Handled Shutdown Scripts
Unlike modern versions of Microsoft Windows that integrate native shutdown scripts through Group Policy, Windows 98 lacked built-in operating system support for executing custom scripts automatically during a standard power-down. Because Windows 98 was built on a hybrid 16-bit/32-bit architecture derived from MS-DOS, its shutdown sequence focused purely on terminating active processes and unloading drivers rather than processing administrative maintenance policies. To achieve shutdown script execution, administrators and users had to rely on session-termination messages, custom wrapper scripts, background monitor utilities, or MS-DOS transition files.
The Native Shutdown Sequence
When a shutdown was initiated in Windows 98, the operating system did
not query any central script policy engine. Instead, the kernel
broadcast WM_QUERYENDSESSION messages to all running
top-level graphical applications.
If any application returned zero, the shutdown sequence was canceled.
If all applications acknowledged the message with a non-zero response,
the system sent WM_ENDSESSION and systematically terminated
running processes, flushed file system buffers, unloaded 32-bit kernel
components, and passed control to the real-mode MS-DOS subsystem to
safely park drive heads and display the "It's now safe to turn off your
computer" screen (or trigger an APM/ACPI power-off). Because this
procedure was fixed, arbitrary batch files or scripts could not be
hooked directly into the standard shutdown dialog.
Wrapper Scripts and Automation
The most common way administrators executed tasks before a shutdown was by replacing the traditional "Start > Shut Down" process with custom batch scripts or compiled executables.
These scripts would execute administrative maintenance commands
first—such as deleting temporary files or backing up data—and then
programmatically trigger the system shutdown. In Windows 98, triggering
a system shutdown from a script was commonly achieved using the
RUNDLL32.exe utility:
rundll32.exe user.exe,exitwindowsFor a forced reboot, administrators used:
rundll32.exe shell32,SHExitWindowsEx 2By hiding the default shutdown menu option via system policies
(poledit.exe) and placing custom shortcut scripts on the
desktop, administrators forced users to run maintenance routines before
the operating system terminated.
Background Event Listeners
Another common approach was running a lightweight utility in the
background (often loaded via the Startup folder or the
Run registry key).
These background programs maintained a hidden window designed to
intercept the WM_QUERYENDSESSION message. When the OS
signaled an impending shutdown, the utility paused the termination
process, executed a specified batch file or executable, and only
returned TRUE to the operating system once the maintenance
script had finished running.
The DOSSTART.BAT Fallback
The only native scenario where Windows 98 executed a script after terminating the graphical user interface occurred when selecting "Restart computer in MS-DOS mode."
During this transition, Windows unloaded the GUI, re-entered
real-mode MS-DOS, and automatically executed
C:\WINDOWS\DOSSTART.BAT. While intended for loading
real-mode CD-ROM drivers, mouse drivers, or sound utilities for legacy
games, this batch file served as a reliable post-Windows script
execution environment before native shutdown script support was formally
introduced in Windows 2000.