我正在尝试编写一个只运行两个可执行文件的小程序。目前,由于某种原因,它只运行第一个:
#include <windows.h>
#include <iostream>
using namespace std;
main(){
cout << "Running Borderless Window..." << endl;
system("BorderlessWindowed.exe");
cout << "Running Diablo II MultiRes..." << endl;
system("D2MultiResGame.exe.lnk");
}
这只是一个运行暗黑破坏神II+无边界窗口程序的小程序。
这将完成任务
#include <windows.h>
#include <iostream>
using namespace std;
main(){
cout << "Running Borderless Window... and Diablo II MultiRes" << endl;
system("cmd /c start BorderlessWindowed.exe&&D2MultiResGame.exe.lnk");
// this is what i have tried
// system("cmd /c start notepad.exe&&mspaint.exe");
// which starts notepad and mspaint one after another
}
好吧,因为system()
要求在启动第二个进程之前完成第一个进程,所以我只创建了一个启动这两个进程的批处理文件,并让.exe启动批处理文件。