系统( "bcdedit /set safeboot" ) 未将窗口设置为安全启动
system("bcdedit /set safeboot") does not set windows to safeboot
这是带有命令的c 代码,命令命令在safeboot中使用网络模式和重新启动,此代码仅在32位操作系统中运行,但在64位中仅重新启动,但不会发生在安全启动模式下。
[注意]:我以管理模式运行应用程序。
system("bcdedit /set safeboot network > Out.txt");
system("shutdown -r -f -t 0");
以及ShellExecute()
ShellExecute(0, L"open", L"cmd.exe", L"/C bcdedit /set safeboot network > Out.txt", 0, SW_HIDE);
ShellExecute(0, L"open", L"cmd.exe", L"/C shutdown -r -f -t 0 > Out.txt", 0, SW_HIDE);
我尝试在管理模式下手动喜欢打开CMD
c:WINDOWSsystem32>bcdedit /set safeboot network
The Operation completed successfully.
c:WINDOWSsystem32>shutdown -r -f -t 0
手动工作(在Safeboot中运行),但是当我尝试重新启动代码窗口时,但不在Safeboot中。
如何使这项工作既有32位和64位操作系统?
您是否使用System()调用作为管理员来运行程序?如果您不这样做,我不会期望这个电话会成功。
> Out.txt
可能不是有效的参数。如果您想获取输出,那么最好使用CreateProcess或一些包装器(例如bost.process.proces.process)手动重定向它们。
上午在64
位计算机上执行该程序。bcdedit.exe
文件存在于C:WindowsSystem32
中,尽管C:WindowsSystem32
处于系统路径中,但在x86
进程中受文件系统重定向器的约束。这意味着C:WindowsSystem32
实际上可以解决C:WindowsSysWOW64
C:WindowsSysWOW64
中没有32
BIT版本
解决方案是更改目标AnyCPU
或x64.
相关文章:
- 将 SDL2 窗口设置为特定显示
- 如何在win32的窗口类中设置动态菜单?
- 如何设置与其背景图像大小相对应的窗口大小?
- 设置窗口几何图形特性的正确方法
- Win32 C++ 将窗口位置设置为右下角
- QT:即使在static_cast后也无法在主窗口中设置对象的位置
- C# - 显示对话框将所有者设置为非托管窗口
- 如何在窗口上设置使用 CreateProcess 创建的新进程的主线程的堆栈大小?
- 如何设置终端窗口的固定尺寸
- Win32/Gdigrab - 如何将另一个进程窗口设置为无边框
- 系统( "bcdedit /set safeboot" ) 未将窗口设置为安全启动
- 将我的窗口设置为C 类
- c++ qt 主窗口设置图像后的对话框"确定"按钮
- 移动窗口 - 设置最小宽度/高度
- 如何在OSX中使用C++opencv highgui将活动窗口设置为opencv图像
- 将Mac Eclipse更改为窗口设置
- 如何基于QProcess将窗口设置为活动窗口
- 如何将gtkmm窗口设置为在屏幕中央打开
- 将qtc++主窗口设置为始终在底部macosx上
- 当窗口设置为活动状态时获取通知