I am trying to sleep my PC using this command
system("C:\\Windows\\System32\\psshutdown -d -t 0");
it works fine if I use cmd, but when I run this in cpp, I got this
'C:\Windows\System32\psshutdown' is not recognized as an internal or external command, operable program or batch file.
32-bit applications running on WOW64 will be put under file system redirection . Therefore if your app is a 32-bit one, the call system("C:\\\\Windows\\\\System32\\\\psshutdown -d -t 0");
will look for psshutdown.exe
in C:\\Windows\\SysWOW64
and failed. You have some solutions:
system(R"(C:\\Windows\\Sysnative\\psshutdown -d -t 0)");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.