How to skip pause in batch file

前端 未结 2 1612
北海茫月
北海茫月 2020-12-05 22:32

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 myScrip

2条回答
  •  清歌不尽
    2020-12-05 23:14

    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.

提交回复
热议问题