Home
Windows Registry Tweaks
Index Page
Hardware
Disk Drives
Mice and Keyboards
Modems and Communications
Printers and Plotters
Processor and Motherboard
Video and Graphics
Network
Clients
Internet and Remote Access
Protocols
TCP/IP
WINS
Servers
Security
Active Desktop
Control Panel
Display
Network
Passwords
Printers
System
Desktop and Explorer
Login and Authentication
Network
Privacy
Remote Access
Start Menu and Taskbar
Documents and Folders
System
Software
Internet Explorer
Appearance
Network and Connections
Search Features
Security
Media Player
Microsoft Office
Outlook
Netmeeting
Outlook Express
pcAnywhere
Windows CE
Windows Messenger
Tips and Tricks
Configuration Files
AUTOEXEC.BAT
BOOT.INI
CONFIG.SYS
MSDOS.SYS
SYSTEM.INI
Customization
Keyboard Shortcuts
Windows
Accessories
Command Processor
Dr Watson
Registry Editor
Task Scheduler
Windows Installer
Appearance and Display
Icons and Fonts
Menus And Windows
Desktop
Explorer
File System
Caching and Memory
Files and Shortcuts
Maintenance
Login and Authentication
Start Menu and Taskbar
Documents and Folders
Taskbar
Startup and Shutdown
System
Scripts
Services
Windows File Checker
Troubleshooting
Crash Control
Logging
Repair
Registry FAQ
Dreamage
Book List
Downloads
Support Forums
Newsletter
Download Updates
Subscribe
Registry Guide for Windows Registry Guide for Windows
Part of the Dreamage Network
Dreamage Network and Software
Registry tweaks, tricks & hacks to optimize, enhance and secure Microsoft Windows.

Command Line Option to Reboot or Log Off Windows (Windows 95/98/Me)
Category: Home > Windows > Login and Authentication

This command allows you to create a shortcut or execute from a batch file a Windows DLL that will bypass the standard Start Menu method of shutdown and initiate a Log Off, Shutdown or Restart.

For Windows 98 & Me
Either execute the following command from a batch file or create a new shortcut, by right-clicking on the descktop and selecting New -> Shortcut. With the command:

C:\WINDOWS\RUNDLL32.EXE shell32.dll,SHExitWindowsEx x

Where x is either 0, 1, 2, 4 or 8 (or a combination) based on the following table:

0 - Log off: Shuts down all running processes, then logs the user off.
1 - 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.
2 - Reboot: Shut down and restart the system.
4 - Force (Win98 Only): 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.
8 - Power Off (Win98 Only): Shuts down the system and turns off the power. The system must support the power-off feature.

Click Next and enter the name you want to call the icon (e.g. Shutdown).

For Windows 95
Repeat the steps above but use the command below for the target.

C:\WINDOWS\Rundll32.exe User,ExitWindows

Note: The values above can be combined together 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" (i.e. 2 + 4)

Disclaimer: Modifying the registry can cause serious problems that may require you to reinstall your operating system. We cannot guarantee that problems resulting from modifications to the registry can be solved. Use the information provided at your own risk.

Last Modified: September 29, 2001

 Return to Index Copyright © 1998-2003. All Rights Reserved.  License