0

我需要提交命令:

bcdedit /set {default} recoveryenabled No

但它不适用于 Inno Setup。

我试过如下:

[Setup]
PrivilegesRequired=admin

[Run]
Filename: "{cmd}"; Parameters: "/c ""bcdedit.exe /set recoveryenabled No""";

但我仍然看到No未应用。正如您在下面看到的,它仍然存在Yes。但是当我从命令提示符手动执行相同的命令时,它可以工作。知道为什么它在 Inno Setup 中不起作用吗?我也在setup.exe以管理员身份运行。

C:\windows\system32>bcdedit /v

Windows Boot Manager
--------------------
identifier              {9dea862c-5cdd-4e70-acc1-f32b344d4795}
device                  partition=\Device\HarddiskVolume2
path                    \EFI\Microsoft\Boot\bootmgfw.efi
description             Windows Boot Manager
locale                  en-GB

integrityservices       Enable

timeout                 30

Windows Boot Loader
-------------------

device                  partition=C:
path                    \windows\system32\winload.efi
description             Windows 8.1
locale                  en-GB

integrityservices       Enable
recoveryenabled         Yes
isolatedcontext         Yes
allowedinmemorysettings 0x15000075
osdevice                partition=C:
systemroot              \windows

nx                      OptIn
bootmenupolicy          Standard
quietboot               Yes
4

1 回答 1

1

可能有很多原因。很难说,因为您没有提供太多信息来调试它。

使用/K代替/C是第一步,因为它将保持cmd.exe窗口打开,以便您可以查看是否有任何错误消息。


当我[Run]在一个简单的安装程序中使用您的部分条目时,我得到:

“bcdedit.exe”不是内部或外部命令、可运行程序或批处理文件。

在我的系统上(我相信在你的系统上也是如此),这是因为我运行的是 64 位 Windows 并且bcdedit.exeC:\Windows\System32. 作为 32 位应用程序中的 Inno Setup,默认情况下它被重定向到C:\Windows\SysWOW64(32 位版本的C:\Windows\System32)。并且没有 32 位版本的bcdedit.exe.

添加Flags: 64bit以使 Inno Setup 找到 64 位版本的bcdedit.exe.

.exe此外,通过命令解释器 ( )运行应用程序是没有意义的cmd.exe

[Run]
Filename: "bcdedit.exe"; Parameters: "/set recoveryenabled No"; Flags: 64bit

或者使用64 位安装模式

于 2015-10-23T06:11:26.527 回答