C++ 使用C+执行CMD命令+;
我正试图使用此命令睡眠我的电脑C++ 使用C+执行CMD命令+;,c++,windows,cmd,32bit-64bit,wow64,C++,Windows,Cmd,32bit 64bit,Wow64,我正试图使用此命令睡眠我的电脑 system("C:\\Windows\\System32\\psshutdown -d -t 0"); 如果我使用cmd,效果很好,但是当我在cpp中运行这个时,我得到了这个 'C:\Windows\System32\psshutdown' is not recognized as an internal or external command, operable program or batch file. 在WOW64上运行的32位应
system("C:\\Windows\\System32\\psshutdown -d -t 0");
如果我使用cmd,效果很好,但是当我在cpp中运行这个时,我得到了这个
'C:\Windows\System32\psshutdown' is not recognized as an internal or external command, operable program or batch file.
在WOW64上运行的32位应用程序将处于禁用状态。因此,如果您的应用程序是32位的,则调用
系统(“C:\\Windows\\System32\\psshutdown-d-t0”)
将在C:\Windows\SysWOW64
中查找psshutdown.exe
,但失败。您有一些解决方案:
- 改为使用Sysnative访问realsystem32文件夹:
system(R“(C:\Windows\Sysnative\psshutdown-d-t0)”代码>
- 明确(一般应避免)
- 或者最好将应用程序重新编译为64位应用程序