What to do when one has to execute batch script from the c++ source code ?
System command can solve the purpose in this context.
Here is the syntax details :-
Example :-
Suppose if some one want to restart a service named "TestService" form the batch file.
Then c:\\sample.bat file would look like as:-
calling it from source code:-
For API refrenece
http://msdn.microsoft.com/en-us/library/277bwbdz(v=vs.90).aspx
System command can solve the purpose in this context.
Here is the syntax details :-
int system( const char *command );
int _wsystem( const wchar_t *command );
Example :-
Suppose if some one want to restart a service named "TestService" form the batch file.
Then c:\\sample.bat file would look like as:-
net stop TestService
net start TestService
calling it from source code:-
system ("c:\\sample.bat");
For API refrenece
http://msdn.microsoft.com/en-us/library/277bwbdz(v=vs.90).aspx