Board logo

标题: [求助]定时关机的vbs脚本在有的xp(xpsp3)下不能定时关机 [打印本页]

作者: diangongban     时间: 2009-2-1 13:56    标题: [求助]定时关机的vbs脚本在有的xp(xpsp3)下不能定时关机

下面这个脚本为什么?在有的xp下可以定时关机在有的xp(xpsp3)下不能定时关机?  谢谢了
Dim mytime,myout1,myout2
mytime=null
mytime=InputBox("请输入定时时间(格式20:10:05)"&vblf&"如果想倒计时关机,请输入倒计时时间"&vblf&"(单位/分钟)"&vblf&"输入‘xxx'可以马上关机"&vblf&"退出点‘取消'","定时关机","1")
Set wshshell=wscript.createobject("wscript.shell")
If IsNumeric(mytime)=False Then
If IsDate(mytime)=True Then
wshshell.run "at "&mytime&" shutdown -s" '定时关机在任务列表中
myout1=MsgBox("定时成功!电脑将在"&mytime&"关机!放弃关机请点‘取消'!",vbokcancel,"定时关机")
If myout1=vbcancel Then
wshshell.run "at /delete /y"
MsgBox "关机已取消!",64,"定时关机"
End If
Else
If mytime="xxx" Then
wshshell.run "shutdown -s -t 0"
End If
MsgBox "输入错误!请重新输入!",64,"定时关机"
End If
Else
If mytime>600 Or mytime<=0 Then
MsgBox "输入错误!倒计时不能多于10小时(600分钟)!",64,"定时关机"
wscript.quit
End If
wshshell.run "shutdown -s -t "&mytime*60
myout2=MsgBox("设置成功!电脑将在"&mytime&"分钟后关机!放弃关机请点‘取消'!",vbokcancel,"定时关机")
If myout2=vbcancel Then
wshshell.run "shutdown -a"
MsgBox "关机已取消!",64,"定时关机"
End If
End If
───────────────── 版务记录 ─────────────────
执行:HAT
操作:[2009-02-06]在帖子标题中增加搜索关键字;代码加code标签
说明:原标题"[求助]帮忙看看这个vbs脚本"不利于论坛搜索
处罚:扣除2点积分
提示:建议阅读以下帖子
{1415}提问的智慧
{7326}论坛新手必读,所有人的基本行为准则
{22703}请不要做浮躁的人
{27314}反面教材:本论坛“精彩”标题小集
{32667}愤怒:那些连标题都写不清楚的人们啊,你们醒醒吧
{32825}本版严厉整顿烂帖
───────────────── 版务记录 ─────────────────


[ Last edited by HAT on 2009-2-6 at 14:04 ]
作者: slore     时间: 2009-2-1 14:03
shutdown -s -t 3600

你在SP3上运行看看,有没有1小时的倒计时框。

shutdown -a取消
不能运行没有错误提示麽?
作者: voiL     时间: 2009-2-1 19:00
看是不是把Task Scheduler给关了?

如果关了的话shutdown是没有倒计时的。
作者: everest79     时间: 2009-2-1 19:22
shutdown这个命令在外部调用时起不起作用取决于用户权限,这个权限是在本地安全策略中指定的,默认是超级管理员
作者: diangongban     时间: 2009-2-5 22:12
谢谢各位老师答复
2楼:shutdown -s -t 3600   有1小时的倒计时框  但是不能运行上面的脚本

[ Last edited by diangongban on 2009-2-5 at 22:16 ]