Shutdown PC

When I execute the below code, I get an error message saying "'shutdown' is not recognized as an internal or external command, operable program or batch file"

#include "stdafx.h"
#include "iostream"
#include "stdlib.h"

int main()
{
using namespace std;

system("shutdown.exe /s");
system("pause");
return 0;
}

For God's sake, somebody help!
Last edited on
the command isn't shutdown.exe /s its

system("shutdown -s");
read these windows api's:

InitiateShutdown
ExitWindows
InitiateSystemShutdown


http://msdn.microsoft.com/en-us/library/aa376883(VS.85).aspx


these are the standard api's if you want to shutdown the system. calling only shutdown /s wont work correctly, neither you will get any return value if the system shutdown fails.
Topic archived. No new replies allowed.