- 1 year ago
Sign multiple files with signtool.exe
To sign multiple files using signtool.exe
in Windows, you can use a loop or a batch file to iterate over the files and sign each one individually. Here's an example using a batch file:
Open a text editor and create a new file with a
.bat
extension (e.g.,sign_files.bat
).Add the following content to the batch file:
batch@echo off
set SIGNING_CERTIFICATE="C:\Path\to\YourCertificate.pfx"
set PASSWORD=YourCertificatePassword
set FILES_TO_SIGN="C:\Path\to\File1.exe" "C:\Path\to\File2.dll" "C:\Path\to\File3.msi"
for %%i in (%FILES_TO_SIGN%) do (
echo Signing %%i...
signtool.exe sign /f %SIGNING_CERTIFICATE% /p %PASSWORD% /t http://timestamp.digicert.com %%i
)
echo All files signed successfully.
Update the
SIGNING_CERTIFICATE
variable with the path to your PFX certificate file. ReplaceYourCertificate.pfx
with the actual file name.Update the
PASSWORD
variable with the password for your certificate.Update the
FILES_TO_SIGN
variable with the list of file paths you want to sign. Separate each file path with a space.Save the batch file.
Open a Command Prompt, navigate to the directory where you saved the batch file, and run the batch file by typing its name:
sign_files.bat
The batch file will iterate over each file path specified in FILES_TO_SIGN
, sign each file using signtool.exe
, and display a message indicating whether the signing process was successful.
Make sure you have signtool.exe
and the required certificate files available in the specified paths. Adjust the paths and commands as per your specific setup.
Note: Ensure that you have the necessary permissions and privileges to sign files using signtool.exe
and access the certificate files.