展开全部
Set colOperatingSystems = GetObject("winmgmts:{(Shutdown)}").ExecQuery("Select * from Win32_OperatingSystem")
Function shut()
setTime=InputBox("请输入多少时间后关机(单位:秒)"," 定时关机", "", 100, 100)
If setTime<>"" Then
IF IsNumeric(setTime) Then
timeS=setTime*1000
wscript.sleep timeS
For Each objOperatingSystem in colOperatingSystems
ObjOperatingSystem.Win32Shutdown(1)
Next
Else wscript.echo "输入错误,请重试"
shut()
End If
Else wscript.echo "操作取消"
End If
End function
shut()
Function shut()
setTime=InputBox("请输入多少时间后关机(单位:秒)"," 定时关机", "", 100, 100)
If setTime<>"" Then
IF IsNumeric(setTime) Then
timeS=setTime*1000
wscript.sleep timeS
For Each objOperatingSystem in colOperatingSystems
ObjOperatingSystem.Win32Shutdown(1)
Next
Else wscript.echo "输入错误,请重试"
shut()
End If
Else wscript.echo "操作取消"
End If
End function
shut()
更多追问追答
追问
可以加一个取消吗·?
追答
那你还不如直接用shutdown指令,取消很简单。
展开全部
写个批处理的:
@echo off
set /p stime=请输入时间:
at %stime% Shutdown -s -t 5
pause
@echo off
set /p stime=请输入时间:
at %stime% Shutdown -s -t 5
pause
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
dim WSHshellA
dim a
set WSHshellA = wscript.createobject("wscript.shell")
a=inputbox("您想要几秒后关机?") * 1000
wscript.sleep a
WSHshellA.run "cmd /c "shutdown -s""
dim a
set WSHshellA = wscript.createobject("wscript.shell")
a=inputbox("您想要几秒后关机?") * 1000
wscript.sleep a
WSHshellA.run "cmd /c "shutdown -s""
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询