使用system()运行两个可执行文件 [英] Run two executables with system()

查看:443
本文介绍了使用system()运行两个可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个仅运行两个可执行文件的小程序.目前,由于某种原因,它仅运行第一个:

I'm trying to write a small program that just runs two executables. Currently it only runs the first one for some reason:

#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");
}

这只是一个运行Diablo II + BorderlessWindow程序的小程序.

It's just a small program to run Diablo II + a BorderlessWindow program.

推荐答案

这将完成任务

#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()运行两个可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆