Hello,
Thank you for the explanation.
I have further investigate this and I think I found the root cause of this problem.
At a first glance, I found out that the
bcdedit.exe is found in
C:\Windows\System32 location.

- bcdedit.png (26.95 KiB) Viewed 7500 times
If you go to
C:\Windows\SysWOW64 location --> open a cmd prompt from there and type in, for instance:
you will get the following error:
'bcdedit.exe' is not recognized as an internat or external command, operable program or batch file.
This is the same error I've been getting when trying to run the .BAT file from the Finish Dialog (to test your scenario).
Even though you are echo-ing the "Rerun as admin" message, that does not seem to be the case.
Long story short, the problem here is the fact that your setup, being a 32-bit setup (
"Install Parameters" page -->
"Package Type" -->
"32-bit package") installed on a 64-bit machine, the redirection comes in place and the setup tries to run your .BAT file using the 32-bit cmd executable which can be found in the
"SysWOW64" folder, instead of the one located in the
"System32" folder.
When you right click on the .bat file -->
"Run as administrator", the 64-bit cmd executable is used by default (since you are on a 64-bit machine) (from
System32 folder) and this is why it works as expected.
With that being said, in order to avoid such a behavior, please go to
"Custom Actions" page and create a
"Launch File" custom action as it follows:

- CA.png (129.96 KiB) Viewed 7500 times
If your .BAT file is named differently, simply type
"[" in the
"File to launch:" field -->
"File" and then, in the spawned dialog, select your .BAT file.
Hope the explanations helped and things are more clear now.
Best regards,
Catalin
FOLLOW US
Get the latest news in Application Packaging