hidden scheduled task

When running a batch file or ruby script (even .rbw) or anything that does not have a GUI, a cmd window normally pops up. This is surely unwanted when scheduling a task with those kind of programs. Sadly, I don’t see any checkbox to hide the window at runtime in the scheduled task wizard.

The best way I found is posted at http://serverfault.com/questions/9038/run-a-bat-file-in-a-scheduled-task-without-a-window.

Schedule a .vbs script containing something like:

Set WinScriptHost = CreateObject("WScript.Shell")
WinScriptHost.Run Chr(34) & "C:\Scheduled Jobs\mybat.bat" & Chr(34), 0
Set WinScriptHost = Nothing

There are other tools like hstart and cmdow that lets you do pretty much the same thing, but I prefer using built-in tools a lot more.

Leave a Reply