Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command line commands with C

Tags:

c

windows-7

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.

like image 449
Qosmo Avatar asked Dec 23 '10 01:12

Qosmo


People also ask

Can I use C in CMD?

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.

What does C do in command line?

/C Carries out the command specified by the string and then terminates. You can get all the cmd command line switches by typing cmd /? .

How do I change C to D in 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.


1 Answers

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.

like image 84
AndersK Avatar answered Oct 07 '22 01:10

AndersK