Option Explicit
On Error Resume Next
Dim input,oFSO,obat,oExe,strPath,wshshell,strName,ifok,bool
strName="定时关机"
strPath="c:\\panda_shutdown.bat"
input=MsgBox("设定关机时间请按“是”取消定时关机请按“否”" ,vbinformation+vbyesno,strName)
Set oFSO=CreateObject("Scripting.FileSystemObject")
Set wshshell=CreateObject("wscript.shell")
Set obat=oFSO.CreateTextFile(strPath,true)
If input=7 Then
obat.WriteLine "shutdown -a"
obat.Close
Set oExe=wshshell.exec(strPath)
'MsgBox"定时关机已取消",vbinformation,"定时关机"
Else
bool=1
input=""
input=InputBox("请输入时间(单位:分钟):",strName)
If input=0 Then
ifok=MsgBox("现在关机?",vbinformation+vbyesno,strName)
If ifok=7 Then
bool=0
End If
Else If input<0 Then
MsgBox"时间有误!",vbinformation+vbyesno,strName
bool=0
End If
End If
If bool=1 Then
obat.WriteLine "shutdown -s -t "&input*60
obat.Close
Set oExe=wshshell.exec(strPath)
End if
'MsgBox"定时关机已设置",vbinformation,"定时关机"
End If
wscript.sleep 1000
oFSO.DeleteFile(strPath)
On Error Resume Next
Dim input,oFSO,obat,oExe,strPath,wshshell,strName,ifok,bool
strName="定时关机"
strPath="c:\\panda_shutdown.bat"
input=MsgBox("设定关机时间请按“是”取消定时关机请按“否”" ,vbinformation+vbyesno,strName)
Set oFSO=CreateObject("Scripting.FileSystemObject")
Set wshshell=CreateObject("wscript.shell")
Set obat=oFSO.CreateTextFile(strPath,true)
If input=7 Then
obat.WriteLine "shutdown -a"
obat.Close
Set oExe=wshshell.exec(strPath)
'MsgBox"定时关机已取消",vbinformation,"定时关机"
Else
bool=1
input=""
input=InputBox("请输入时间(单位:分钟):",strName)
If input=0 Then
ifok=MsgBox("现在关机?",vbinformation+vbyesno,strName)
If ifok=7 Then
bool=0
End If
Else If input<0 Then
MsgBox"时间有误!",vbinformation+vbyesno,strName
bool=0
End If
End If
If bool=1 Then
obat.WriteLine "shutdown -s -t "&input*60
obat.Close
Set oExe=wshshell.exec(strPath)
End if
'MsgBox"定时关机已设置",vbinformation,"定时关机"
End If
wscript.sleep 1000
oFSO.DeleteFile(strPath)









