Hi,
I would like to run a batch file from a c++ programme. Is there any command availabe that i can use for the above process.
Thanks in Advance,
Varadha
Printable View
Hi,
I would like to run a batch file from a c++ programme. Is there any command availabe that i can use for the above process.
Thanks in Advance,
Varadha
Use CreateProcess to launch cmd.exe with the batch file you want to run.
Ex. "cmd.exe /C mystuff.bat"
The /C parameter of cmd.exe tells cmd.exe execute the supplied batch file and terminate when complete.
Execute "cmd /?" at a command prompt to see what else you can do. :)
Alternatively, you can call ShellExecute with the operation parameter set to NULL (so the default action is used). This should cause the batch file to be executed by the command processor (cmd.exe).
- Robert
I' ve used the "system" command.
system("BatchFile.bat");
It works and never caused a problem.
This FAQ offers several methods. Just pick the one you prefer....