Reputation: 357
I went through the questions but could not find the exact same issue as what I am encountering.
I installed Signtool following the instructions under Windows 11, and am trying to apply the instructions here: https://learn.microsoft.com/en-us/windows/win32/seccrypto/using-signtool-to-sign-a-file
I simply type :
signtool sign myprog.exe
And I get the below. What gives ? :
At line:1 char:72 ... les (x86)\Windows Kits\10\bin\10.0.22000.0\x64\Signtool" sign ChecksB ... ~~~~ Unexpected token 'sign' in expression or statement. CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException FullyQualifiedErrorId : UnexpectedToken**
Upvotes: 3
Views: 701
Reputation: 4405
In my case, I was trying to execute the following command in Windows Powershell console.
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x86\signtool.exe" sign /fd sha256 /tr http://ts.ssl.com /td sha256 /sha1 b4e6e78db24d93c2540xxx69a0b2643922124191 FileToBeSigned.exe
Digging a litle, this behaviour is due to the way PowerShell interprets the command. In PowerShell, double quotes are used to denote strings, and any spaces or special characters within the command can cause parsing issues.
To resolve this, you can use the & the begining of the line.
& "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x86\signtool.exe" sign /fd sha256 /tr http://ts.ssl.com /td sha256 /sha1 b4e6e78db24d93c2540xxx69a0b2643922124191 FileToBeSigned.exe
Or do like me, switch to Windows Command Console, first executing CMD.EXE
and then the original command, which worked like a charm.
Upvotes: 0
Reputation: 10343
The output looks strange, you seem to be in a folder called "Signtool". If you use Powershell you need to use .\
to invoke an application in the current directory, for example:
cd 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x86\'
and then
.\signtool.exe sign C:\myprog.exe
Upvotes: 1