开发者

Schedule .bat isn't executing VBScript properly

So I've got 2 things going on: a program that checks the status of some folders, then a VBScript that runs afterwards to email recipients of any errors going on in said folders. Even if there is none, it's supposed to send a "No Errors" email.

Both of them work perfectl开发者_如何学Cy fine individually. The checker .exe program runs with no issues, and when I run the VBScript by itself, it sends all the emails it's supposed to. However, I put the following into a .bat file to run nightly at 11pm:

"C:\batch\night_monitor\checker.exe"
"C:\batch\night_monitor\emailer.vbs"

For some reason, when the batch file is run, only 1 out of 5 emails go out. By default, all the flags are set to true, and when I look in the log file, I see that the emailer.vbs is only checking 2 error logs instead of 5. Like I said though, the emailer works perfectly fine if I just run it by itself. Is there something major that I'm missing here?


Try this..

@ECHO OFF
START "Checker" /WAIT "C:\batch\night_monitor\checker.exe"
START "Emailer" /WAIT "C:\batch\night_monitor\emailer.vbs"

Run START /? from a command line to see all the options.


It seems your checker.exe isn't finished when emailer.vbs is started.

Try running your programms in sequence:

"C:\batch\night_monitor\checker.exe" & "C:\batch\night_monitor\emailer.vbs"

... or execute emailer.vbs only if checker.exe executed successfuly:

"C:\batch\night_monitor\checker.exe" && "C:\batch\night_monitor\emailer.vbs"

Another alternative would be to call checker.exe from inside emailer.vbs to make sure it has finished before you access the error logs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜