简体   繁体   中英

Solutiousing system function to run bat file with arg from vc++

I am new in visual c++ and I am practicing to develop very simple application.

I am still learning so please guide me.

I am trying to run a batch file withing visual c++ and need to add an arg after it.

String ^ arg = textBox1->Text;

system("file.bat"); // how can I add my arg here?

the arg depends on user's input from textbox.

Thank you very much in advance...

solution:

String ^ arg = textBox1->Text; Process::Start("C:\\file.bat", arg);

I have tried this:

#include <iostream>
#include <iostream>
using namespace std;

int main()
{
    string str = "*.txt";
    system((string("dir ") + str).c_str());
    return 0;
}

and this works

我认为system("file.bat " + arg)可以工作吗?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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