I'm sorry if this was covered before, but I can't find it anywhere on StackOverflow.
Basically I'm trying to run things that you usually run at a Windows command prompt:
msiexec /i file.msi /q
and other sort of commands from my C program. Is this possible?
Thanks.
We usually use a compiler with a graphical user interface, to compile our C program. This can also be done by using cmd. The command prompt has a set of steps we need to perform in order to execute our program without using a GUI compiler.
/C Carries out the command specified by the string and then terminates. You can get all the cmd command line switches by typing cmd /? .
For instance, if you wanted to change the drive from C: to D:, you should type: d: … and then press Enter on your keyboard. To change the drive and the directory at the same time, use the cd command, followed by the /d switch.
In windows using the Win API ShellExecute will give you best control of your child process. However the other two methods mentioned by Dave18 and Pablo work as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With