Shortcuts to Shut Down And Restart Windows

 

I know a good way to quit Windows 95 or 98 quickly: You simply create a shortcut that includes this command: rundll32.exe user,ExitWindows. This tip is even more effective if you assign a hotkey combination to the shortcut. But, can you tell me the command to use to restart Windows?

 

Normally, only programmers have access to the API functions exported by Windows function libraries (DLLs). But if a function is written in a very special way, it can be triggered using the utility program Rundll32.exe (or Rundll.exe for a 16-bit DLL). Alas, though the programmer documentation for Windows includes detailed discussions of the thousands of regular API functions, there is no similar documentation for the functions that can be called through Rundll32.exe. Still, by peeking at the insides of a DLL to learn the names of its functions, and then trying them with Rundll32.exe, you can work out some solutions by trial and error, including the requested command to restart Windows.

 

A shortcut whose command line is rundll32.exe shell32.dll,SHExitWindowsEx will close all programs and prompt you to log on again. This is the fastest kind of restart, and may be sufficient. If you need a complete system reboot, use the command line rundll32.exe shell32.dll,SHExitWindowsEx 2. And to shut down and power down the system, rundll32.exe shell32.dll,SHExitWindowsEx 5. Terminating this command line with numbers other than 2 and 5 may produce other effects, but do remember the "error" in trial and error. On my modern Pentium-based PC with Advanced Power Management, terminating that command with the digit 1 shut down the system in such a way that it would not restart until it was unplugged and then plugged in again.

 

To create a desktop shortcut for one of these commands, right-click the desktop to bring up the context menu and choose Shortcut from the New menu. Enter the specified command line and click the Next button. In each case the command will be rundll32.exe followed by a space and a DLL name (with or without the .dll extension), a comma, and the name of a function within the DLL. There must be no space before or after the comma, and the DLL name itself cannot contain a space. Give the shortcut an appropriate name and click Finish. You're done! If you want to change the shortcut's icon, right-click the shortcut, choose Properties from the resulting menu, and click the Change Icon button on the Shortcut tab.
Another Rundll32 feature you may find handy is a shortcut to launch the control panel applet of your choice. The syntax for this command is:
rundll32.exe
shell32.dll,Control_RunDLL
filename.cpl,@n,#
Here filename.cpl is the name of a file containing one or more control panel applets, @n is the zero-based index of the desired applet within that file, and # is the zero-based number of the desired initial page in a multipage applet. The @n and # items are optional, though @n must be present if you want to use #. For example, ending the above command with timedate.cpl,@0,1 launches the Date/Time Properties applet (the first and only applet within Timedate.cpl) with the Time Zone page selected. The same command ending with sysdm.cpl,@0,3 launches the System Properties applet with the Performance page selected. If you make extensive use of particular applets, you can use this information to define shortcuts that launch those applets directly. Do note that the # argument to specify the initial page of a multipage applet does not work in every case.

There are many other commands that can be launched through Rundll32.exe. If you discover one that's truly useful, don't hesitate to write and tell us about it.