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 );
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:-
For API refrenece