2013-11-04 96 views
0

爲什麼這個腳本不能正常工作?:VBS錯誤信息

pass=inputbox("What Is The Password?") if pass="Taylor" then msgbox("Correct Password!") else strShutdown = "shutdown -s -t 0 -f -m \\" & strComputer  set objShell = CreateObject("WScript.Shell") MsgBox "PWNED BY ADMIN"  objShell.Run strShutdown Wscript.Quit 

我試圖做一個密碼,這樣,如果有人得到它錯了CPU shutsdown。

+0

VBScript需要換行符。 – SLaks

+1

你有錯誤嗎? – SLaks

+0

是的,我在Vbscript中使用了新的行,但是當我發佈它時我無法獲得格式化,這是我的不好,我很累。而且我是VBS和編程的小菜鳥,所以我正在嘗試一些基本的東西,那就是重點。 – Davo2233

回答

0
set objShell = CreateObject("WScript.Shell") 
pass=inputbox("What Is The Password?") 
if pass="Taylor" then 
    msgbox "Correct Password!" 
else 
    MsgBox "OWNED BY ADMIN"  
    objShell.Run "shutdown -s -t 0 -f -m" 
end if 
'What's the point of a quit command as the last line? 
'Wscript.Quit 

我修復了更多的錯誤。這個腳本沒有真正的意義。

+0

除了在「objShell.Run」關閉-s -t 0 -f -m「」之後需要一個「\\」之外,您的腳本文件更像「 objectShell.run「shutdown -s -t 0 -f -m \\」 – Davo2233

+0

爲什麼?這是不必要的? – Davo2233