当前位置:编程学习 > C#/ASP.NET >>

求助:哪位大侠可以给个VBS写的重启电脑脚本啊

哪位大侠可以给个VBS写的重启电脑脚本啊,本人新手上路,所以写代码遇到不少问题,自己写的在vista,xp,都可以运行,但是不知道为什么2003运行就没有效果。代码如下:
Dim ws
Set ws = CreateObject("wscript.shell")
ws.run "cmd /c shutdown -r -t 0", 0

大侠们最好有脚本提供哦,谢谢,分肯定会多多的给!! --------------------编程问答-------------------- 有没有哪位大侠可以帮忙一下,谢谢啦~ --------------------编程问答--------------------

我要怎么给你呢,我的直接就是一个EXE文件.

你用的时候直接就可以重启电脑.

--------------------编程问答--------------------

我的那个在 WIN 7 上也是一样的效果的.

我的邮箱  Simon_8888@yeah.net --------------------编程问答-------------------- 我自己的脚本如下:
dim strComputer 
strComputer = "."
'wscript.echo "Rebooting "&strComputer
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate,authenticationLevel=Pkt,(Shutdown)}!\\" & _
        strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
    ("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
    ObjOperatingSystem.Reboot()
Next
可是WINDOWS 2003是没有反应的,我在cmd里面运行了一下shutdown -r -t 0报错如下:
The computer is processing another action and thus cannot be shut down. Wait until the computer has finished and then try again。
不知道大侠有没有解决办法呢?
补充:.NET技术 ,  其他语言
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,