可以.vbs文件是一个预定脚本?(can .vbs file be a scheduled scri

2019-08-05 01:42发布

我写这目前是由用户手动运行.vbs脚本。 我怎样才能让这个脚本的时间表本身的任务计划程序在Windows XP和Windows 7(以固定时间,每天自动运行),它是手动执行的第一次?

编辑

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

谢谢,

Answer 1:

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

c:\windows\system32\cscript.exe PATH_TO_YOUR_VBS


Answer 2:

你当然可以做一个VBS文件计划任务。

需要说明的,虽然是你什么都不想要提示用户......没有投入,没有消息框,什么都没有。 确保你已经处理并记录你的异常或者你可以使用永不完成任务发现自己(或更糟的是,操作气愤地给你打电话,因为一个消息框,在凌晨3点突然出现,并停止生产工艺)



Answer 3:

在Windows 8:被触发有消息框,如果在Windows的任务是谁真的是登录到计算机上,并在相同的用户下运行将只显示消息框VB脚本窗口的任务,如果任务配置为Windows的“只有在运行用户登录”我认为这改变了在Windows 8上,作为Windows 7我根本没有配置任务以这种方式



Answer 4:

试试这个

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


文章来源: can .vbs file be a scheduled script?