A command in a .bat file is unrecognized when the .bat file is called from an Inno Setup but works fine when I run the bat file manually

后端 未结 2 927
说谎
说谎 2020-12-20 06:26

I have the following .bat file:

fbwfmgr /enable
.
.
.
fbwfmgr /addexclusion c: \"some folder 1\"
fbwfmgr /addexclusion c: \"some folder 2\"
.
.
.


        
相关标签:
2条回答
  • 2020-12-20 06:40

    Isn't it, because there's only 64-bit version of the fbwfmgr in the C:\Windows\System32 on the system?

    As Inno Setup in a 32-bit application, it by default gets redirected to C:\Windows\SysWOW64 (32-bit version of C:\Windows\System32). If there's no 32-bit version of fbwfmgr in the C:\Windows\SysWOW64, Inno Setup cannot find it.

    Add the Flags: 64bit to make Inno Setup find 64-bit version of the fbwfmgr.

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

    [Run]
    Filename: "fbwfmgr.exe"; Parameters: "/enable"; Flags: 64bit
    

    With a batch file, the mechanics is bit more complicated. Inno Setup by default (being a 32-bit applications) runs a 32-bit cmd.exe, which in turns looks into the C:\Windows\SysWOW64. If you add the Flags: 64bit, Inno Setup will run a 64-bit cmd.exe, which will look into the C:\Windows\System32.

    [Run]
    Filename: "{tmp}\set_write_protection_rules.bat"; Flags: 64bit
    

    Or use the 64-bit install mode.


    For a similar question, see PowerShell script executed from Inno Setup is failing with "Retrieving the COM class factory for component with CLSID {XXXX} failed - error 80040154".

    0 讨论(0)
  • 2020-12-20 06:47

    You probably need to provide the path to fbwfmgr.

    e.g.

    "C:\Users\JOHNDOE\SomeDir\fbwfmgr“

    Note

    You will almost certainly need to run the batch script with administrative privileges too! I know you said you are logged in as the administrator, but you need to be certain that you have the permission for the script to be running especially as you are running it from another application, (inno).

    0 讨论(0)
提交回复
热议问题