can .vbs file be a scheduled script?

与世无争的帅哥 提交于 2019-11-28 14:25:45

Create a scheduled task to run the following command:

c:\windows\system32\cscript.exe PATH_TO_YOUR_VBS

You can certainly make a vbs file a scheduled task.

The caveat, though, is you want NOTHING to prompt the user...no inputs, no message boxes, nothing. Make sure you've handled and logged your exceptions or you could find yourself with a task that never completes (or worse, operations angrily calling you because a message box popped up at 3am and halted a production process)

on Windows 8: windows tasks that are triggering VBScripts having message boxes will only display the message boxes if the windows task is run under the same user who really is logged on the machine and the if the windows task is configured to "run only if the user is logged on" I think this changed on windows 8, as on windows 7 I did not had to configure the task in that way

bobbobbob

try this

X=MsgBox("Take the Quiz!")

name=inputbox("Name")

q1=inputbox("Question 1 - How many days are there in a leap Year?")

q2=inputbox("Question 2 - How many Suns does Neptune have?")

q3=inputbox("Question 3 - What is your name?")

q4=inputbox("Question 4 - What did one computer say to the other?")

q5=inputbox("Question 5 - Why did the chicken cross the road?")

msgbox("Answers!")

msgbox("Q1 - How many days are there in a leap Year?, you answered ") + q1 + (" ,the correct answer is 366")

msgbox("Q2 - How many Suns does Neptune have?, you answered ") + q2 + (" ,the correct answere is one, our sun.")

msgbox("Q3 - What is your name?, you answered ") + q3 + (", the correct answer is ") + name + (" or is it?")

msgbox("Q4 - What did one computer say to the other?, you answered ") + q4 + (", the correct answer is, 011100110111010101110000 (Binary code for sup)")

msgbox("Q5 - Why did the chicken cross the road?, you answered ") + q5 + (", the correct answer is To get to the other side")

msgbox("Well done, ") + name + (" you have completed the quiz")
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!