forked from Synergex/CodeGen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSignFile.bat
More file actions
37 lines (26 loc) · 766 Bytes
/
SignFile.bat
File metadata and controls
37 lines (26 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
rem @echo off
setlocal
pushd %~dp0
if "%1"=="" goto usage
set FILE_TO_SIGN=%1
if not exist "%FILE_TO_SIGN%" (
echo ERROR: File %FILE_TO_SIGN% was not found!
goto done
)
set TIMESTAMP_URL=http://timestamp.entrust.net/TSS/RFC3161sha2TS
echo.
for %%F in ("%FILE_TO_SIGN%") do echo Signing %%~nxF
rem Should be able to use %WindowsSdkDir% but it looks like Visual Studio clears it for some reason!
rem This is the command used with the certificate on the physical USB device.
"C:\Program Files (x86)\Windows Kits\10\bin\x86\signtool.exe" sign /fd SHA256 /a /tr "%TIMESTAMP_URL%" "%FILE_TO_SIGN%"
if "%ERRORLEVEL%"=="0" (
echo SUCCESS!
)
goto done
:usage
echo.
echo Usage: SignFile <fileSpec>
echo.
:done
popd
endlocal