且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在c ++中执行shell命令

更新时间:2023-11-30 10:44:40

可以使用 system()函数来执行shell命令。
例如:
system(DIR)在CMD shell中执行DIR命令。开始时的默认目录是您 .exe 文件所在的目录。
'system(PAUSE)`执行PAUSE命令。
要执行的命令应作为常量字符串传递给函数。

You can use the system() function to execute shell commands. For example: system("DIR") executes the DIR command in the CMD shell. The default directory at the start is the directory you're .exe file is located. 'system("PAUSE")` executes the PAUSE command. The command/s you wannt to execute should be passed as a constant string to the function.

对于paritcular程序,语法(IMO)将是:

For you paritcular program the syntax (IMO) would be:

system(java -jar Tool.jar -b x .fit x.csv)