I have created Signer.vbs file for do this functionality and below is the VBScript code to sign all files digitally for particular folder. This folder contains scripting files.
Dim sCertificate
Dim sFolder
Dim sStore
Dim objSigner
Dim objFSO
Dim objFolder
Dim colListOfFiles
Dim objFile
sCertificate = "MyCert"
sFolder = "D:\App\Project\VALab\SC\VBSigningProcess\FilesToSign"
sStore = "my"
Set objSigner = WScript.CreateObject("Scripting.Signer")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(sFolder)
Set colListOfFiles = objFolder.Files
For Each objFile in colListOfFiles
WScript.Echo "File Name : " & objFile.Path & vbnewline & "Certificate : " & sCertificate & vbnewline & "Store : " & sStore
objSigner.SignFile objFile.Path, sCertificate
Next
Above code throwing error on below line "Cannot find the certificate and private key to use for decryption, Error Code: 8009200C"
objSigner.SignFile objFile.Path, sCertificate
"MyCert" certificate located inside MMC. Please review below image.