How do i run or access a .bat file in c++? Is this possible? Also, can it be done using the standard library instead of API/MFC?
Thanks in advance. :) :D :cool:
Printable View
How do i run or access a .bat file in c++? Is this possible? Also, can it be done using the standard library instead of API/MFC?
Thanks in advance. :) :D :cool:
You can use the system() function to run it as if from the command line. You need to include stdlib.h or process.h to use system().
Just change "filename.bat" for whatever the name of your batch file is in this code:
If you mean 'access' as in being able to read from or write to the batch file, then you can just use the usual file access functions to do so, like fopen() (C style) or ifstream/ofstream (C++ style).Code:system("filename.bat");
Thanks a lot Harry, that is exactly what i was wanting to know!