c++ \" escape sequence for purpose of including quotes inside system() function

2.5k Views Asked by At

I have a question about using the \" escape sequence. enter image description here So my first question would be how would I get this cmd statement to work?

cd "c:\users\aegis\" $T sup.cmd

I am also aware of the ability to use & and && inside of the system function, but could someone provide me with a better understanding of how this would work?

#include "stdafx.h"
#include <iostream>



int _tmain(int argc, _TCHAR* argv[])
{

    system("start c:\\users\\aegis\\sup.cmd");

The following code works to open the cmd, but I want to have more control. I am also currently pending on a question waiting for someone to explain to me thorougly how systemexecute() systemexecuteEx() and createprocess() work. I am fairly new to c++ so I feel as though createprocess and systemexecute() may be too far in depth for me.

1

There are 1 best solutions below

0
On

Just escape the " character with \, then your system() call would look like this:

system("start \"c:\\users\\aegis\\sup.cmd\"");