Hello, I use this to sign single file with my certificate: Code: C:\Program Files (x86)\Windows Kits\10\bin\x64/signtool.exe sign /v /sm /s Root /n WRTJBCert /tr http://tsa.starfieldtech.com /ph /fd sha256 C:\Directory\File.exe But now, I need something, which will sign all (EXE, DLL, CAB) files in C:\Directory and all sub-directories. So for example: C:\Directory\File.dll C:\Directory\File2.dll C:\Directory\File.exe C:\Directory\Subdirectory1\File.cab C:\Directory\Subdirectory2\File.cab C:\Directory\Subdirectory3\File.cab C:\Directory\Subdirectory3\File.dll C:\Directory\Subdirectory3\File.exe C:\Directory\Subdirectory3\File2.exe etc... Could anybody hint me a script for this? Thanks.
Code: @echo off set "signer=C:\Program Files (x86)\Windows Kits\10\bin\x64\signtool.exe" cd /d "%~dp0" for /f "delims=" %%A in ('dir /b /s *.cab') do (call :sign %%A) for /f "delims=" %%A in ('dir /b /s *.dll') do (call :sign %%A) for /f "delims=" %%A in ('dir /b /s *.exe') do (call :sign %%A) goto :fin :sign "%signer%" sign /v /sm /s Root /n WRTJBCert /tr http://tsa.starfieldtech.com /ph /fd sha256 %1 goto :eof :fin echo. echo. echo Press any key to Exit pause >nul goto :eof
great! I knew you will help me. thanks. so I will run it within the directory, which contains the files, which need to be signed (and subdirs with such files)
IT IS WORKING!!! I just replaced: (call :sign %%A) with (call :sign "%%A") because there are [SPACE]s in the directory structure.