I know there is a piece of code that allows you to run a dos program, but I can't rember what it is. I want to run a program that will tell a dos bat file to run. can anyone help me???
Printable View
I know there is a piece of code that allows you to run a dos program, but I can't rember what it is. I want to run a program that will tell a dos bat file to run. can anyone help me???
one way I can think of is:
Code:system("path\\to\\bat");
this is the code i usually use to run an exe (if i'm using a system call):...or were you saying that you wanted to run something like command.com and then pass a batch file to it?Code:system("start \"[TITLE]\" [PATH] /B");
edit: don't forget about the escape sequences, as pointed out by the above post
and how do I initiate a your system command. What lib is it in??? I am a student, and am just learning. My teacher couldn't remember the command. I'd appreciate assistance. I have a program that is outputting data to a text file, and then I have a bat file that tells the computer to print the text file to the local printer. How can I tell the program to run the bat file.
Here.
The header file is stdlib
to run a bat file in your program add this line somewhere in your code:
replace "c:\\mybatfile.bat" with the path to your bat file, and don't forget to use \\ instead of just one \Code:system("c:\\mybatfile.bat");
hth