Shutdown

提供: AutoHotkey Wiki
移動: 案内検索

実行制御 | GUI表示 | 演算・変数 | メモリ・DLL操作 | 文字列操作 | キーボード | マウス | シェル | ウィンドウ | ウィンドウグループ
ステータスバー | コントロール | サウンド | ファイル | INIファイル | レジストリ | 環境変数 | AutoHotkey | その他 | 設定関係 | オブジェクト

Shutdown[編集]

システムを終了、再起動、ログオフする。

Shutdown, Code

Parameters[編集]

引数名 説明
Code 以下のものの和。
0 ログオフ
1 シャットダウン
2 再起動
4 強制的
8 実行後電源を切る

Remarks[編集]

OnExitサブルーチンを設定しておき、 A_ExitReason変数を調べれば、ユーザーがシャットダウンやログオフを行おうとしたことを知ることができる。

Related[編集]

Run, ExitApp, OnExit

Example(s)[編集]

; Force a reboot (reboot + force = 2 + 4 = 6):
Shutdown, 6
; サスペンドやハイバネートを行いたい場合は、下記のようにWindowsのAPIを呼び出す。
; Windows 95/NT4: Since this function does not exist, the following call would have no effect.
; Parameter #1: Pass 1 instead of 0 to hibernate rather than suspend.
; Parameter #2: Pass 1 instead of 0 to request permission from each application prior to suspending.
; Parameter #3: Pass 1 instead of 0 to disable all wake events.
DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0)