Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to skip pause in batch file

Tags:

batch-file

In windows batch file, if myScript.bat runs otherScript.bat, and in otherScript.bat, there's a pause in first line. How can I send a keystroke to skip that pause in myScript.bat? So my script won't need to take any extract keystroke and won't be blocked by the pause. Thanks.

like image 498
Stan Avatar asked Aug 27 '10 11:08

Stan


People also ask

How do you pause 10 seconds in a batch file?

Type in your command. TIMEOUT — Type timeout time where "time" is replaced by the number of seconds to delay. For example, typing in timeout 30 will delay your batch file for 30 seconds.

What is Pause command in batch file?

pause. When placed in a batch file, pause stops the file from running until you press a key to continue.


1 Answers

One way would be to use the echo command to do the keystroke for you.

For example:

myScript.bat

@echo OFF  @echo Calling otherScript.bat... @echo | call otherScript.bat @echo Done. 

otherScript.bat

pause @echo Hello World 

Stefan's solution is more flexible and allows you to control when to pause or not, but this solution will work if you're not able to revise otherScript.bat for some reason.

like image 84
Patrick Cuff Avatar answered Sep 21 '22 18:09

Patrick Cuff