Running bat files

Oct 24, 2013 at 4:51am
I want to know if you can run bat files from code? If so how else how can you shutdown a computer with code? OS is windows 7.
Last edited on Oct 24, 2013 at 4:56am
Oct 24, 2013 at 5:04am
Yes you can run external programs within your program. Also there are several ways to shutdown the computer using c++.

http://msdn.microsoft.com/en-us/library/windows/desktop/aa376868(v=vs.85).aspx
Oct 24, 2013 at 8:32am
Rightly mentioned by giblit here is one way to call the bat files from the code:-

>> using system call.
http://www.cplusplus.com/reference/cstdlib/system/

Here is the details of shutdown command

>> http://pcsupport.about.com/od/commandlinereference/p/shutdown-command.htm


One referring article to it :-
>> http://tajendrasengar.blogspot.in/2013/10/running-bat-file-from-c-source-code.html
Last edited on Oct 24, 2013 at 8:51am
Topic archived. No new replies allowed.