2016-11-28

invisible.vbs

Why I needed the script

When you want to run a script as the currently logged on user as a scheduled task, the CMD will popup as a black window. I searched the Internet and found this several different solutions, but this one can be used to launch any other CMD-scripts.
Source: http://superuser.com/questions/62525/run-a-batch-file-in-a-completely-hidden-way

What it does

It runs the CMD-script in the background without any popup. Please note that the task scheduler thinks the task is finished when the vbs script has finished, even if the CMD-script still runs in the background. This is something I need to look at some time, if you know how to make it wait for the CMD to finish, please let me know!

How I run it

In CMD you can run it with cscript.exe, but if launched as a scheduled task I prefer to run it with wscript.exe.



' invisible.vbs
' Use this to run batch script invisible
' wscript.exe "<PATH>\invisible.vbs" "<PATH>\MyBatchFile.cmd"
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False