Smart Recent Blog Post List

Discover the power of algorithms

Complexities of algorithm, thier applicability. Optimization techniques associated with diffrent algos.

Discover Power of Blogging

What is Blogging , is it a Dream or Passion or Award or Making Money ?

Think Diffrent, be creative

Let's see how much conclusion one can draw from it. This will help testing your creativity.

Discover the power of technology

Technolgy, Programming, Optimization , Gadgets and more...

Discover the power of Blogging

Google widgets and gadgets.

Oct 1, 2013

Running bat file from the C++ source code

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

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




Smart Recent Blog Post List