how to do “press enter to exit” in batch

后端 未结 7 1187
眼角桃花
眼角桃花 2021-02-06 19:59

I am using rake to build my project and I have a build.bat file similar to this:

@echo off
cls
rake

When I double click on build.bat the dos wi

7条回答
  •  走了就别回头了
    2021-02-06 20:48

    Default interpreters from Microsoft are done in a way, that causes them exit when they reach EOF. If rake is another batch file, command interpreter switches to it and exits when rake interpretation is finished. To prevent this write:

    @echo off
    cls
    call rake
    pause
    

    IMHO, call operator will lauch another instance of intepretator thereby preventing the current one interpreter from switching to another input file.

提交回复
热议问题