user285594
user285594

Reputation:

Inno Setup - bcdedit is not working

I need to submit the command:

bcdedit /set {default} recoveryenabled No

but it's not working with Inno Setup.

I have tried as below:

[Setup]
PrivilegesRequired=admin

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

But I still see the No is not applied. As you can see below, it still remains Yes. But when I manually do the same command from command prompt, it works. Any idea why it is not working within Inno Setup? I'm also running the setup.exe as administrator.

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

Upvotes: 0

Views: 1601

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202177

There can be many reasons. It's difficult to tell as you didn't provide much information to debug this.

Using /K instead of /C is the first step, as it will keep the cmd.exe window open, so that you can see, if there are any error messages.


When I use your [Run] section entry in a trivial installer, I get:

'bcdedit.exe' is not recognized as an internal or external command, operable program or batch file.

On my system (and I believe it would be the same on yours), it's because I'm running Windows 64-bit and the bcdedit.exe is in C:\Windows\System32. As Inno Setup in a 32-bit application, it by default gets redirected to C:\Windows\SysWOW64 (32-bit version of C:\Windows\System32). And there's no 32-bit version of bcdedit.exe.

Add Flags: 64bit to make Inno Setup find 64-bit version of bcdedit.exe.

Also, there's no point running .exe application via command interpreter (cmd.exe).

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

Or use 64-bit install mode.

Upvotes: 1

Related Questions