I want to run CMD-file, as described here.
I set run file every 5 minutes in the task scheduler. But when the scheduler runs the file - the window flashing. How to run CMD-file in background mode?
Installed Windows 7.
Answer
For full text and alternative methods see http://www.ericphelps.com/batch/samples/invisible.txt:
Save this one line of text as "invisible.vbs":
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False
To run any program or batch file invisibly, use it like this:
wscript.exe "C:\Wherever\invisible.vbs" "C:\Some Other Place\MyBatchFile.bat"
This is just a little dangerous because your batch file MUST be able to close itself and MUST never produce an error which might require user input. Otherwise the batch file will hang invisibly until system shutdown or until someone kills it with the task manager.
No comments:
Post a Comment