我的代码不适用于
我正试着给我的朋友看
这是代码,它是一个信息框
Dim objShell, strComputer, strInput
Dim strRestart
pass=inputbox( "test time! what is 2+2?" )
if pass="4" then
msgbox=( "you is smart" )
else
DO
msgbox( "you cant do math now i will self destruct" )
Set WSHShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "C:WINDOWSsystem32shutdown.exe -r -t 0"
出现的第一个错误:将Dim strRestart移到新行。
I。E: 代替
Dim objShell, strComputer, strInput Dim strRestart
用途:
Dim objShell, strComputer, strInput
Dim strRestart
第二个错误出现在第4行:
msgbox=("you is smart")
应该是
msgbox("you is smart")
第三个错误出现在第6行:
移除DO。DO是DO的一部分。。WHILE语句用于循环,而且你似乎只想有一个if/else子句。
总而言之:
Dim objShell, strComputer, strInput
Dim strRestart
pass=inputbox( "test time! what is 2+2?" )
if pass="4" then
msgbox( "you is smart" )
else
msgbox( "you cant do math now i will self destruct" )
Set WSHShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "C:WINDOWSsystem32shutdown.exe -r -t 0"
end if
干杯。