Click here to return to the KiXtart HelpDesk main page...

KiXtart 2001 Manual

Shutdown( )

Action: Allows you to shut down or reboot a computer.
 
Syntax: SHUTDOWN ("computer", "message", wait, force, reboot)
 
Parameters: Computer

The name of the computer you want to shut down or reboot. An empty string("") indicates the local computer.

Message

String that specifies a message to display in the Shutdown dialog box.

Wait (optional)

Optional parameter specifying the time in seconds that the dialog box is displayed. While the dialog box is displayed, system shutdown can be stopped by using the Win32 AbortSystemShutdown function.

If wait is not zero, SHUTDOWN displays a dialog box on the specified computer. The dialog box, which displays the name of the user who called the function and the message specified by message, prompts the user to log off. The system beeps when the dialog box is created.

The dialog box remains on top of other windows and can be moved but not closed. A timer counts down the time remaining before a forced shutdown. If the user logs off, the system shuts down immediately. Otherwise, the computer is shut down when the timer expires.

If wait is zero, the computer shuts down without displaying the dialog box, and the shutdown cannot be stopped by AbortSystemShutdown.

Force

Specifies whether applications with unsaved changes are forcibly closed. If force is not zero, applications are closed. If force is zero, a dialog box is displayed prompting the user to close the applications.

Reboot (optional)

Optional parameter specifying whether the computer is to restart immediately after shutting down. If reboot is 1, the computer restarts. If reboot is 0, the computer does not start.

Remarks: SHUTDOWN does not work reliably on Windows 9x due to an issue in the underlying Windows API. As a workaround, try the following command sequence:

SHELL "%windir%\RUNDLL32.EXE user.exe,ExitWindowsExec"
SHELL "%windir%\RUNDLL32.EXE user.exe,ExitWindows"
 

Returns:
0 Shutdown successful
Error code Function failed  
 
See Also: Logoff( )
 
Example:

$RC = Shutdown("", "System is being rebooted to enable new settings.", 60, 0, 1)