I am writing it down. I hope I won't have to waste time any more in the future for the same problem.
The key to run a VBScript by "Schtasks.exe" is at "/tr" field the command to run should be "C:\Windows\System32\CScript.exe //B" followed by the script itself.
I found my answer at the answer by Stephen Quan to this posted question.
You should useCScript.exeoverWScript.exeso that commands likeWScript.Echowill be output to console instead of Dialog Box. As you point out, the scheduled task should avoid MessageBox or any UI elements that could cause your script to block.I recommend scheduling your script as follows:C:\Windows\System32\CScript.exe //Nologo //B X:\PathToYourScript\YourScript.vbsThe options I choose for you are "Prevent logo display" and "Batch mode". Consult your online help by runningCScript /?on a Command Prompt.
No comments:
Post a Comment