ykjoker 发表于 2011-1-2 21:45:10

倒计时关机

我想做个windows bat的命令,关机倒计时关机怎么做啊
shutdown -r -t 30 -c "系统安装完成!30秒后会自动重启!"

转换为 AU3代码

KLU3K 发表于 2011-1-2 23:59:41

Sleep(30000);运行30秒
$Box = MsgBox(4, "注意", "点击是关机,否取消!");提示对话框
If $Box = 6 Then;如果点击是
        Shutdown(4 + 8);强制+关闭电源
Else;点击否
        Exit;退出程序
EndIf

lxz 发表于 2011-1-3 19:44:31

#include <GUIConstants.au3>
GUICreate("倒计时关机", 250, 150,180,80)
$Button1 = GUICtrlCreateButton("确定(&Y)", 30, 110, 73, 25, 0)
$Button2 = GUICtrlCreateButton("退出(&X)", 150, 110, 73, 25, 0)
GUISetState(@SW_SHOW)

$Label = GUICtrlCreateLabel('倒计时: 10 秒',28,45,250,40)
GUICtrlSetFont(-1, 26, 400, 0, "MS Sans Serif")
Local $C = 0, $w = 10, $T1 = TimerInit()

While 1
        If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
        $T2 = Int(TimerDiff($T1) / 1000)
        If $T2 >= $w Then ExitLoop
        If $T2 > $C Then
                $C = $T2
      GUICtrlSetData($Label , '倒计时: ' & $w - $T2 & ' 秒')
        EndIf
$nMsg = GUIGetMsg()
Switch $nMsg
Case $Button1
ExitLoop
Case $Button2
Exit
EndSwitch
WEnd
_guanji()
Exit

Func _guanji()
shutdown(4+8)
EndFunc   ;==>_timer

xsjtxy 发表于 2011-1-3 20:22:43


if msgbox(4,"","系统将于30秒后关机,点是立即关机,点否取消关机!",10)=7 then exit
Shutdown(5)
页: [1]
查看完整版本: 倒计时关机