Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/157.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 使用C+执行CMD命令+;_C++_Windows_Cmd_32bit 64bit_Wow64 - Fatal编程技术网

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位应用程序