i want execute bath file using system() , path file passed function this:
void executebatch(char* batchfile){ system(batchfile); }
now issue path passed in not have escape quotes ignore spaces example user input:
"c:\\users\\500543\\documents\\batch file project\\testing.bat"
how add escape quotes path passed in?
so essentually change:
"c:\\users\\500543\\documents\\batch file project\\testing.bat"
to
"\"c:\\users\\500543\\documents\\batch file project\\testing.bat\""
i assume want that:
void executebatch(char* batchfile){ string cmd(batchfile) string expandcmd = string(""\\") + cmd + string("\\""); system(expandcmd.c_str()); }
Comments
Post a Comment