calling batch files
I have recently completed a command line based (DOS) test automation system which consists of various batch files calling C programs. I am now attermpting to create a GUI wrapper for this system in C++ to make it more user friendly.
I want to know whether you can call batch files through the 'system("batchfile")' function call ? If not the how do you call batch files from C programs ?
>I want to know whether you can call batch files through
>the 'system("batchfile")' function call
You'd find out pretty quick if you tried it, wouldn't you?
Why don't you try and find out yourself.
What I know is that there are lot of ways to call batch files.
For example: _execv, _execl, CreateProcess (this one is more difficult but very powerful).
Thankyou both for your 'useful' replies - makes me feel proud to be a member of the board.
Seriously though, I have tried (of course) to call batch files like this: system("call batchfilename") BUT it does not work.
Any other ideas ?
Keep trying because it should work...
This works fine on my machine.
system("C:\\test.bat arg1 arg2");
>Thankyou both for your 'useful' replies
Perhaps you should do some research before asking a question then. You'll get fewer sarcastic remarks.
>I have tried (of course) to call batch files like this: system("call
>batchfilename") BUT it does not work.
Because call is a batch command and system is a command line function. All you have to do is give system the path and file name of the batch file:
system ( "C:\\SomeDirectory\\someBatch.bat" );
And any arguments that it needs.