# C++ code for running dos programs

This is a discussion on C++ code for running dos programs within the C++ Programming forums, part of the General Programming Boards category; I know there is a piece of code that allows you to run a dos program, but I can't rember ...

1. ## C++ code for running dos programs

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???

2. one way I can think of is:
Code:
system("path\\to\\bat");

3. this is the code i usually use to run an exe (if i'm using a system call):
Code:
system("start \"[TITLE]\" [PATH] /B");
...or were you saying that you wanted to run something like command.com and then pass a batch file to it?

edit: don't forget about the escape sequences, as pointed out by the above post

4. ## yes to run a bat file

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.

5. Here.
system("c:\\mybatfile.bat");