SETSYSTEMSTATE

Action

Changes the (power)state of the computer.

 

Syntax

SETSYSTEMSTATE (mode, force)

 

Parameters

Mode

Optional parameter specifying one of the following modes:

Value

Action

0

Lock system (supported on Windows 2000 or higher only).

1

Standby.

2

Hibernate.

3

Poweroff.

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.

Returns

 

0

Action succeeded

System error code

Action failed

 

 

Example

$RC = SetSystemState( 1 , 1 )  ; Force system to StandBy mode