简体   繁体   English

批处理文件执行后,为什么CMD窗口没有关闭?

[英]Why won't the CMD window close after Batch file execution?

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. 我也尝试过使用Exit命令,但是它不会自动关闭窗口。

The command in my batch file: 我的批处理文件中的命令:

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

The /w parameter makes START wait until the process it launches has exited. /w参数使START等待启动过程退出。 Remove it: 去掉它:

start "" /B /d ...

This will let your batch file continue running and exit immediately. 这将使您的批处理文件继续运行并立即退出。

Remove the /b (and the /w ) from the start command. 从启动命令中删除/b (和/w )。 The /b starts the program in the same window and the /w keeps the window open until the program terminates. /b在同一窗口中启动程序, /w使窗口保持打开状态,直到程序终止。

You can close the console at the end 您可以在最后关闭控制台

For example: 例如:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM