Why won't the CMD window close after Batch fil

2019-03-05 13:00发布

问题:

I am trying to execute a file by placing the appropriate command into a batch file. After completing the file execution the command window is not closing automatically. I tried it with the Exit command too but it is not closing the window automatically.

The command in my batch file:

start "" /w /B /d "%CD%\Project-Aug-New\MyCardApi\trunk\src\build\bin" MyCardApiTest_32d.exe
exit 0

回答1:

Remove the /b (and the /w) from the start command. The /b starts the program in the same window and the /w keeps the window open until the program terminates.



回答2:

The /w parameter makes START wait until the process it launches has exited. Remove it:

start "" /B /d ...

This will let your batch file continue running and exit immediately.



回答3:

You can close the console at the end

For example:

   start /b taskkill /F /IM bank01.exe
   ..
   ..
   taskkill /F /IM cmd.exe