Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

c++ run .exe file with parameters

Tags:

c++

exe

Im trying to run exe file with c++ with no luck

I tried this:

system("C:\\Program Files (x86)\\Counter-Strike Condition Zero 1.2 build 2771\\hl.exe");

How i can run hl.exe with parameters?

Thanks

Update:

'C:\Program' is not recognized as an internal or external command, operable program or batch file im getting this error.

I tried system("C:\\hl.exe"); and it works good. I think problem is in whitespaces

like image 713
Irakli Lekishvili Avatar asked Nov 30 '25 04:11

Irakli Lekishvili


1 Answers

You can run your executable with parameters by adding them to the end of hl.exe as you would on the command line.

system("C:\\Program Files (x86)\\Counter-Strike Condition Zero 1.2 build 2771\\hl.exe fullscreen");

where fullscreen is the parameter to run hl.exe with.

With spaces in the path you can put quotes around the string containing the executable path:

system("\"C:\\Program Files (x86)\\Counter-Strike Condition Zero 1.2 build 2771\\hl.exe\" fullscreen");
like image 164
Bill Nelson Avatar answered Dec 01 '25 17:12

Bill Nelson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!