VB中SHUTDOWN命令

来源:百度知道 编辑:UC知道 时间:2024/06/22 07:54:26
怎么把“SHUTDOWN -T 时间”中的时间用数字代替

On Error GoTo err100
If mnutimeclose.Caption = "定时关机" Then
mnutimeclose.Caption = "取消定时关机"
Dim xx As Single
xx = InputBox("请输入时间,1表示一个小时、0.5表示半个小时", "关机时间/小时", 1)
If xx <= 0 Then
xx = InputBox("请重新输入时间,1表示一个小时、0.5表示半个小时", "关机时间", 1)
mnutimeclose_Click
End If
xx = xx * 3600
Shell Sound.GetWinSys() & "\shutdown.exe -s -t " & xx
Else
Shell Sound.GetWinSys() & "\shutdown.exe -a"
mnutimeclose.Caption = "定时关机"
End If
err100:
End Sub

如果你想以倒计时的方式关机,可以输入"Shutdown.exe -s -t 3600",这里表示60
分钟后自动关机,"3600"代表60分钟。