Vbscript .vbs文件是否可以是计划脚本?

Vbscript .vbs文件是否可以是计划脚本?,vbscript,scheduled-tasks,windows-shell,wsh,Vbscript,Scheduled Tasks,Windows Shell,Wsh,我编写了一个.vbs脚本,目前由用户手动运行。第一次手动执行此脚本时,如何在Windows XP和Windows 7上的Task Scheduler(每天在固定时间自动运行)中对其进行调度 编辑 Option Explicit Dim oShell : Set oShell = WScript.CreateObject ("WScript.Shell") Dim FSO : set FSO = CreateObject("Scripting.FileSystemObje

我编写了一个.vbs脚本,目前由用户手动运行。第一次手动执行此脚本时,如何在Windows XP和Windows 7上的Task Scheduler(每天在固定时间自动运行)中对其进行调度

编辑

    Option Explicit

    Dim oShell : Set oShell = WScript.CreateObject ("WScript.Shell")
    Dim FSO : set FSO = CreateObject("Scripting.FileSystemObject") 
    Dim StartTime,Elapsed 

    'msgBox(oShell.CurrentDirectory)
    'MsgBox(FSO.GetFile(Wscript.ScriptFullName).ParentFolder )
    oShell.CurrentDirectory = FSO.GetFile(Wscript.ScriptFullName).ParentFolder

    StartTime = Timer

    oShell.run "ParentChildLinkFinal.vbs", 1, True
    oShell.run "Parent_Child_Merge_final.vbs", 1, True
    oShell.run "CycleTime.vbs", 1, True
    oShell.run "Baddata.vbs", 1, True
    oShell.run "Matrixrefresh.vbs", 1, True

    Elapsed = Timer - StartTime

    MsgBox("Total time taken to finish this task:" & Elapsed & "in Seconds")

谢谢,

创建计划任务以运行以下命令:

c:\windows\system32\cscript.exe PATH_TO_YOUR_VBS

您当然可以将vbs文件作为计划任务

不过,需要注意的是,您不希望任何东西提示用户……没有输入,没有消息框,什么都不需要。请确保您已经处理并记录了异常,否则您可能会发现自己的任务永远不会完成(或者更糟糕的是,操作部门会因为凌晨3点弹出消息框并停止生产过程而愤怒地呼叫您)

试试这个

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")

在Windows 8上:如果Windows任务是在真正登录到计算机的同一用户下运行的,并且如果Windows任务配置为“仅在用户登录时运行”,则触发具有消息框的VBScript的Windows任务将仅显示消息框
我认为这在windows 8上发生了变化,就像在windows 7上一样,我不必以那种方式配置任务

See@Tomalak可以将我们输入的所有命令保存在类似脚本的文件中,因为我的最终用户没有受过这样的教育。因此,如果所有的事情都可以在脚本中完成,那会更好。有人能看看这个吗?但是这个命令是如何安排的呢?它再次需要手动运行,点击右键?使用我刚刚离开并有点困惑的命令,要安排任务,我需要将我的.vbs放入
C:\`驱动器中,或者我可以将其放入任何完整目录中。还有一件事我可以通过脚本进行手动设置,这样,一旦任何用户第一次运行.vbs脚本,.vbs将被安排到永远。-通过这种方式,我认为我们可以为非技术人员提供更多的帮助。还有其他帮助吗?您可以将VBS文件放在用户可以访问的任何位置,以执行计划任务。必须将VBS文件的完整路径传递到cscript.exe。如果您想让脚本作为一项计划任务自行安装,那么这将涉及更多内容。如果你扩展你的原始问题来描述你的脚本做了什么以及为什么,你可能会得到其他的解决方案,这些解决方案采用了一种更合适的不同的方法。这一点都没有帮助。您没有解释(以文本形式,而不是代码形式)需要完成哪些任务—只是必须运行一组脚本。我希望用户通过这样的方式得到提示消息—他们是希望此.vbs文件(任务)按计划运行,还是希望每次都手动运行?根据他们的反应,脚本的行为将被确定。这取决于你在做什么。我的大多数VBS工作都是在服务器上进行的,并且在无人在场的时候运行。如果你有人在那里,我想你可以使用一个提示…只要知道代码在有人与提示交互之前是不会完成的(这可能是你想要的,也可能不是,取决于你的需求)。我可以有这样的代码,你可以使用,或者你也可以
编辑我的代码吗?