运行EXE形成另一个EXE并传递参数
Run exe form another exe and pass parameters
我正在尝试制作一个调用另一个.exe并传递参数的程序。我的情况是创建一个程序以打开两个(dosbox.exe)并传递命令以运行可执行文件。我正在尝试自动化测试过程。我尝试过这样的代码
ShellExecute(NULL, "open", "C:chatDOSBox 0.74.lnk.exe", NULL, NULL, SW_SHOWDEFAULT);
,但它甚至没有用。有帮助吗?
怎么样: std::system( "dosbox -c myCommand" );
(假设dosbox.exe
和您的自定义myCommand.exe
在您的路径中)?
在后台开始两个,做:
std::system( "start dosbox -c myCommand1" );
std::system( "start dosbox -c myCommand2" );
// Program has launched these in the background
// and continues execution here.
另外,您可以为每个std::system()
调用一个线程:
auto cmd1 = std::async( [] { std::system( "dosbox -c myCommand1" ); } );
auto cmd2 = std::async( [] { std::system( "dosbox -c myCommand2" ); } );
// Program is launching these in the background
// and continues execution here.
您可能还需要检查每个std::system()
调用的返回值以确保其成功。
update :您询问如何在一个位于另一个文件夹中的单个dosbox中的前景中运行两个命令。您可以像这样嵌入完整的路径:
std::system( "c:\MyDosBox\dosbox.exe -c c:\My\Progams\myCommand1.exe p1 p2 && c:\Other\myCommand2.exe p3 p4" );`
相关文章:
- 使用参数在 C# 的C++上运行.exe
- 从 CMD 运行.exe并自动向其传递参数
- 如何循环访问在 cmd 中获取参数的 exe 文件
- 在 Myfile.exe 中0x00831D39时未处理的异常:0xC00000FD:堆栈溢出(参数:0x0000000
- C ShellexeCuteex不会通过未从该EXE产生输出来执行参数
- 运行EXE形成另一个EXE并传递参数
- 通过 cmd 将参数传递给C++编译的 exe
- CreateProcess正在调用cmd.exe,包括没有显示(闪烁)窗口的参数
- 将多个cmd.exe参数/参数传递给Shellexecute(ex)
- 如何在命令中传递多个参数,以使用C/C 和SSH在远程Linux计算机上执行EXE
- .EXE程序的C 命令行参数
- C 将参数发送到EXE文件
- 获取传递给子模块(C#.NET dll)中的主模块(VC++ exe)的参数
- 如何在Visual Studio中获取要发送到cl.exe的命令行参数
- QProcess启动过程(搅拌机.exe)具有多个参数
- C++ 使用参数运行.exe文件
- 通过 *.dll 文件调用 *.exe 文件并提交参数
- 如何识别.exe文件是否需要输入参数
- 我可以从带有参数的exe运行DLL吗?
- 创建我的.exe的批处理版本,它接受命令行参数(ParamCount(), ParamStr()和BCB 4.0中的Fi