【问题标题】:Powershell signcode.exe Innosetup [duplicate]Powershell signcode.exe Innosetup [重复]
【发布时间】:2018-12-11 15:04:56
【问题描述】:

编辑:

我在使用 InnoSetup 和 signtool 时遇到问题。以下内容在命令行中完美运行(我在原始帖子中从 PowerShell 恢复为 CMD)。

"c:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\signtool.exe" sign /f certificate.p12 /p password /t http://timestamp.verisign.com/scripts/timstamp.dll MyApp.exe

但是,如果我在 InnoSetup IDE 中放入同一行(按照 InnoSetup 的要求在末尾添加 $f),则会失败并显示“签名工具失败,退出代码为 0x1”。我已经看到了以下answer,但是在命令行上它工作正常,它没有帮助。 如果没有 codetool 行“SignTool=signtool”,InnoSetup 可以正确编译。

【问题讨论】:

  • “我怀疑在 Windows 10 上 InnoSetup 需要与 PowerShell 中相同的系统税。” - 这是一个非常错误的假设。 - 这是XY problem

标签: inno-setup


【解决方案1】:

在 PowerShell 中,使用 & 符号(又名 调用运算符调用运算符)来执行包含引号和空格的命令名称。

& "c:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\signtool.exe" sign /f certificate.p12 /p password /t http://timestamp.verisign.com/scripts/timstamp.dll MyApp.exe

为什么?因为 PowerShell 将带引号的字符串(行首)解释为字符串,而不是命令。 & 操作符的意思是“后面的字符串是一个命令”。

阅读 PowerShell 帮助主题 about_Operators 了解更多信息。

【讨论】:

  • 即使使用 & 也不起作用,PowerShell 抱怨 & 是错误的语法。无论如何,我转向了普通的命令行。
  • 我发布的命令用于 PowerShell 命令行。如果它不起作用(我会指出you did not say how it didn't work),那么你做的不对(我一直这样做,它工作得很好)。
猜你喜欢
  • 2019-03-18
  • 1970-01-01
  • 1970-01-01
  • 2013-11-29
  • 2018-01-18
  • 1970-01-01
  • 2021-11-04
  • 2013-07-31
  • 1970-01-01
相关资源
最近更新 更多