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




12 comments:

This comment has been removed by a blog administrator.

Nice blog explanation clearly & understandable

Piping Design Engineering course is a job oriented diploma course. Sanjary academy provide best piping design course in Hyderabad, India with job assistance.
best Piping Design Course
piping design course with placement
pipe stress analysis course in hyderabad
piping engineering course in hyderabad
piping stress analysis course
best Piping Design institute
best institute of Piping Design Course in India

In Java programs, this runtime error will be thrown as exceptions. These exceptions are also objects that represent an error or condition that prevents the execution from running normally. If an exception is not handled, then the program will stop abnormally. Exception Handling In Java

I’m sure you must have heard about Fortnite at least once. Fortnite is the best Battle Royale game on the planet right now… Yes, it’s even better than PUBG. This game has very intense gameplay, fun graphics and is way more interesting as compared to other similar games.
Following the accomplishment of the PC version, Epic Games has finally made a Fortnite mobile version. Fortnite has gotten great support and appreciation from gamers everywhere in the world. The reason is straightforward: “While PUBG is a paid game, Fortnite Mobile is totally free.”
https://apkmodule.com/fortnite-mobile-mod-apk/

Do you have any tips on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there!
Appreciate it

B.Com Result 2022 - BCom 1st 2nd 3rd Year Exam Result
BCom 1st year result 2022 | BCom 2nd year result 2022 | BCom 3rd year result 2022.

Love to read it, Waiting For More new Update and I Already Read your Recent Post its Great Thanks.

BA Exam Time Table

APKNIKE provides Free Apps and games for android APK An application file ready for installation
in an Android device. The compressed APK file, which is a ZIP archive in the JAR format

VSCO Mod APK Everything Unlocked Free Download

Thank you so much for the best post. Here we have some fantastic or amazing post for you, which are related to net worth of celebrity, businessman, singers, etc.
Check out below the posts,


Jake pauls Net Worth
50 cent Net Worth
Zendya Net Worth
Adam Sandlers net worth
Ariana Grande Net Worth

Dr. Anubha's Homeopathy Clinic in Hyderabad is a well-known online resource for Classical homeopathy consultation and treatment. You can now access Dr. Anubha's web Homeopathic Clinic from the comfort of your own home, thanks to the convenience of current web technology. Under one roof, this Homeo Care Clinic provides complete solutions to all of your health difficulties. It is well-known as the top homeopathy clinic in Hyderabad, offering effective treatments for a variety of diseases.

https://www.dranubha.com/

Post a Comment