First, about the script
1) The script in this article completes the following functions:
Randomly generates 3 two-digit addition questions and shuts down after 60 seconds if the answer is wrong.
If all correct, also will be in the 60后 shutdown, but the script will be prompted to remove the timer shutdown method
2) When the script is running, the method to exit this script is:
Find Wscript.exe in Task Manager, select end process (e.g.)
3) If you have entered the shutdown countdown reading seconds stage, open the command prompt and enter the following command to end the countdown:
1 shutdown-a
Second, VBS script
1 'version:1.0.20140819.12 3 on Error Resume Next 'skipping statements When an error occurs4 5 'affirming the intent of the procedure6 DimTip7Tip ="boy, you've fallen into my trap now! "&Chr( -) 8tip = Tip &"Well, I'll give you three math questions, and I'll let you go if you make it."&Chr( -)9tip = Tip &"What do you think? "Ten One 'must choose Yes A DimChoice - whileChoice <>vbyes -Choice =MsgBox(Tip, vbYesNo) the IfChoice = vbno Then - MsgBox "boy, you're struggling like a little bit of my youthful charm." - End If - Wend + - 'declaring Variables + DimA'Addend A DimB'Addend at DimEquation'the resulting calculation - DimResult'the input and - - 'generate pseudo-random number - Randomize() - in 'First question -A =int( -+ -*Rnd())'generate random number a tob =int( -+ -*Rnd())'Generate random number B +Equation = A &" + "& B &" = ?" 'Generate a calculation -Result =InputBox(equation)'Ask questions the IfResult <>CStr(A + B) Then 'Judging whether the answer is correct * MsgBox "you can't count such a simple math problem! " $ShutDown'turn off the machinePanax NotoginsengWscript.Quit'Exit Script - End If the + 'second question AA =int( -+ -*Rnd()) theb =int( -+ -*Rnd()) +Equation = A &" + "& B &" = ?" -Result =InputBox(equation) $ IfResult <>CStr(A + B) Then $ MsgBox "you can't count such a simple math problem! " - ShutDown - Wscript.Quit the End If - Wuyi 'Third question theA =int( -+ -*Rnd()) -b =int( -+ -*Rnd()) WuEquation = A &" + "& B &" = ?" -Result =InputBox(equation) About IfResult <>CStr(A + B) Then $ MsgBox "you can't count such a simple math problem! " - ShutDown - Wscript.Quit - End If A + 'fate: Although will also try to shut down the computer, but still spared the DimDestiny -Destiny ="boy, that's a dick, I got you, I'll show you the way"&Chr( -) $Destiny = Destiny &"in a moment you open the command line, enter shutdown-a and you'll be fine." the MsgBoxDestiny the ShutDown the the 'routine: Turn off the computer after 60 seconds - SubShutDown in SetWS = WScript.CreateObject ("Wscript.Shell") theWs. Run"shutdown-s-T",0 the End Sub
[VBS] Shutdown prank