.vbs 文件可以是预定脚本吗? [英] can .vbs file be a scheduled script?

查看:65
本文介绍了.vbs 文件可以是预定脚本吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个 .vbs 脚本,目前由用户手动运行.首次手动执行时,如何在 Windows XP 和 Windows 7 上的任务计划程序中自行安排此脚本(在每天的固定时间自动运行)?

I have written a .vbs script which presently is run manually by users. How can I make this script schedule itself in Task Scheduler (to run at a fixed time each day automatically) on Windows XP and Windows 7 the first time it is executed manually?

编辑

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

谢谢,

推荐答案

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

Create a scheduled task to run the following command:

c:\windows\system32\cscript.exe PATH_TO_YOUR_VBS

这篇关于.vbs 文件可以是预定脚本吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆