Running bat files

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
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
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
Topic archived. No new replies allowed.