Windows Task Scheduler Doesn't Run VBScript

lovechillcool picture lovechillcool · Apr 16, 2015 · Viewed 51.2k times · Source

I am trying to automate a VBScript by using Windows Task Scheduler. However, I tried to use cscript.exe + "C:\...\script.vbs" but it didn't run. I also tried to directly run the same command in CMD (cscript.exe "C:\...\script.vbs") and it worked.

What might be the problem?

EDIT :

I just tried to switch the setting to "Run only when user is logged on" from "Run whether user is logged on or not" and it worked. I am wondering if there is a way to make my task scheduled run even when the user is logged off.

Answer

lovechillcool picture lovechillcool · Jan 21, 2016

After hours of research, one of Blake Morrison (from Microsoft)'s blogs came up; it mentioned that

If running a .vbs / .ps1 script, try launching it from a .cmd / .bat script

see Help! My Scheduled Task does not run…

That blog also explains a lot of rules/tips when using Task Scheduler.

So please create a .cmd/.bat file that calls for your VBScript. For example: cscript.exe YourScript.vbs would be in your .cmd/.bat script.