0

This is the undesired dialog that pops up when I run a Task in the Task Scheduler that just calls a VB script. Any idea how to make my Windows understand, that I do want to run the .vbs file using the windows script host, not some text editor? I already tried Open with > Choose another app and then selecting the host with the Always use this app checkmark.

1 Answer 1

2

When running a script via Task Scheduler, you must run the associated EXE and pass the script name as a parameter. In the case of VBScript, you can run the script using wscript or cscript. Examples:

wscript.exe "c:\scripts\myscript.vbs"
cscript.exe "c:\scripts\myscript.vbs"

Note: The exe name goes in the program field and the script name goes in the arguments field, but if you enter them all together, Task Scheduler will separate them for you.

Note: If your script has any interactive content (e.g. MsgBox) you must use the option "Run only when user is logged on". You can also change all "MsgBox" to "WScript.Echo" and run via CScript.exe.

2
  • Thanks a lot! My script is just executing another .exe with dynamic date parameters so I set the scheduled task to run even when the user is logged out.
    – lenny
    Commented Nov 8, 2022 at 14:24
  • this is really helpful for a completely different case I had. thanks a lot
    – Michel
    Commented Dec 7, 2022 at 19:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .