Function Reference


Shutdown

Shuts down the system.

Shutdown ( code )

Parameters

code A combination of shutdown codes. See "remarks".

Return Value

Success: 1.
Failure: 0 and sets the @error flag to Windows API GetLastError().

Remarks

The shutdown code is a combination of the following values:
    $SD_LOGOFF (0) = Logoff
    $SD_SHUTDOWN (1) = Shutdown
    $SD_REBOOT (2) = Reboot
    $SD_FORCE (4) = Force
    $SD_POWERDOWN (8) = Power down
    $SD_FORCEHUNG (16) = Force if hung
    $SD_STANDBY (32) = Standby
    $SD_HIBERNATE (64) = Hibernate

Constants are defined in AutoItConstants.au3.

Required values should be BitOR()'ed together. To shutdown and power down, for example, the code would be BitOR($SD_SHUTDOWN, $SD_POWERDOWN).

Standby or Hibernate are ignored if other codes are set.

Related

ProcessClose

Example

; Force a reboot

Shutdown(6)