有什么方法可以在正在打开应用程序的VS中将批处理文件作为生成后事件运行?

时间:2019-04-23 15:02:16

标签: c++ visual-studio batch-file visual-studio-2015

总结问题:

我正在为某些项目使用Visual Studio 2015,我想做的是运行一个批处理文件,该文件将打开一个应用程序(无论哪个应用程序)。问题是,VS2015会卡在构建过程中,直到我的应用程序关闭为止。

批处理工作正常。您可以像这样批量处理:

start notepad.exe

或者您想要什么,您在这里打开什么应用程序都没有关系。

我尝试过的内容:

我已经尝试了一些替代方案,例如...

  1. 在构建后事件中使用“ call”,“ start”或不使用蝙蝠来运行蝙蝠。
  2. 我在文件末尾添加了“ exit 0”(批次)
  3. 此外,我尝试创建2个批处理文件。一个是原始的,第二个是第一个。因此,我在构建后事件中添加了第二个。当然没有任何变化。

我要尝试的内容:

最后,我要获取的只是一批,用于在项目的构建/重建完成后打开应用程序而不会卡在某个地方。

enter image description here

即使构建是“成功构建”,它也将保留在“构建”过程中

1 个答案:

答案 0 :(得分:0)

Unfortunately I believe all processes spun off by the build have to be joined and returned successfully for VS to consider the build a success. Instead, is it possible in your use-case to attach the batch file to the execution step of your project? In the project settings you can modify the command line arguments to spin off your batch file before executing your project executable. Is there any issues with this approach?

I found this too, would this help: Visual Studio post build events stuck waiting for executable to finish before running app in debug mode

相关问题