Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Oct 1 '12 at 3:57

This question came from our site for professional and enthusiast programmers.

add comment

1 Answer

up vote 0 down vote accepted

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.

share|improve this answer
1  
You should copy in the relevant part. –  Ariel Sep 6 '12 at 10:26
    
Thank you! VBS - this is what I need. –  Scott Dev Sep 6 '12 at 10:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.