inno-setupcode-signingsigntool

Quotes and spaces in sign command specified on Inno Setup iscc compiler commandline


Using Inno Setup, I've recently tried moving from calling Compil32 for batch creation of setups to using 'iscc'. The following without signing works fine (executed from a batch file from C# code):

iscc "C:\Inno Setup Scripts\test.iss"

But when I try to add signing, the setup is not created:

iscc "C:\Inno Setup Scripts\test.iss" /Ssigntool="C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\signtool" sign /f "C:\Test PFX\test.pfx" /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /a /p codeSigningPassword $f

codeSigningPassword is a password set in the C# code.

I suspect it may have something to do with my placement of quotes - I assumed they should go around any file path having spaces.


Solution

  • The whole /S... parameter with the signtool commandline has to be wrapped to double quotes. And the inner quotes need to be escaped as $q:

    iscc "C:\Inno Setup Scripts\test.iss" "/Ssigntool=$qC:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\signtool$q sign /f $qC:\Test PFX\test.pfx$q /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /a /p codeSigningPassword $f"
    

    The commandline syntax you are trying implies that your .iss file needs to contain corresponding SignTool directive:

    [Setup]
    SignTool=signtool
    SignedUninstaller=yes
    

    See https://jrsoftware.org/ishelp/index.php?topic=setup_signtool


    Alternatives are: