【发布时间】:2012-12-14 17:54:50
【问题描述】:
我编写了一个 .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")
谢谢,
【问题讨论】:
-
@Tomalak 可以将我们放入脚本中的所有命令都像文件一样,因为我的最终用户没有受过太多教育。所以如果所有东西都可以在脚本中完成,那就更好了.
-
谁能看看这个?
标签: vbscript scheduled-tasks windows-shell wsh