无法通过Task Scheduler运行VBScript脚本的技术求助
任务计划程序自动执行VBS脚本失败的排查请求
我编写了一段VBScript脚本,用于打开指定Excel工作簿并运行其中的VBA宏——该宏会检查并整理校准日期已过期或下月到期的工具,最终向我发送包含相关内容的邮件:
Dim xlApp, xlBook Set xlApp = CreateObject("Excel.Application") ' Prevent Excel from popping up xlApp.Visible = False ' Change to your actual file path Set xlBook = xlApp.Workbooks.Open("C:\Users\Todd Harris\Desktop\Monthly Calibration Report.xlsm", 0, True) ' Run your macro name xlApp.Run "CopyDatesAndEmail" xlBook.Close False xlApp.Quit Set xlBook = Nothing Set xlApp = Nothing
手动双击该VBS脚本时可正常运行,但我希望将其设置为每月月初自动执行,通过任务计划程序尝试多次均未成功。我已做以下尝试:
- 勾选「使用最高权限运行」
- 将用户/组改为「Administrators」
- 动作设置:程序/脚本选择
wscript.exe,添加参数为"C:\Users\Todd Harris\Desktop\RunMonthlyCalibrationReport.vbs",起始于"C:\Users\Todd Harris\Desktop"
另外我还编写了一个bat文件,但不确定如何在任务计划程序中设置对应的动作:
@echo off cscript.exe "C:\Users\Todd Harris\Desktop\RunMonthlyCalibrationReport.vbs"
目前不知该如何推进解决这个问题。
内容的提问来源于stack exchange,提问作者Todd Harris
相关产品推荐
相关产品推荐

