How to run commands on cmd prompt

All I need is to open cmd prompt as administrator and pass few commands to there.

I already have:
 
  system("powershell -Command Start-Process 'C:\\Windows\\System32\\cmd.exe' -Verb runAs");


Now I want pass some commands and then exit this cmd, but everything below this line is done in main cmd.
Last edited on
its not like that.

System sends ONE command to the OS. It does not really open a console and play human at it.

you can either do each command in turn with a set of system calls, or you can write a batch file that does them all and call that from your code. Unix lets you put ; between statements to invoke multiple at once, I can't recall if dos does or not, but you can try it
I tried separate statements with ; & && and they are not working how I want. First command open cmd as Administrator, but second and third commands are done in main cmd.
Ok, I think it's impossible to do this. I will just open my program as Administrator and there I will pass some commands.
Topic archived. No new replies allowed.