There would be some situations where we need to call Batch file from Scripts. Here the script to call INSTALL.bat
Function Tilak() dim shell set shell=createobject("wscript.shell") shell.run "INSTALL.bat" set shell=nothing End Function
I am trying to package a .p12 certificate.I tried to use capicom.dll and wrote the batch file.Called the batch file using the vbs u have given. But the certificate is not appearing in the certificate manager. I also tried using another vbs which installs the certificate to the certificate manager,but gives error 1720 at end of installation.Any suggestions where im goin wrong?
.bat file:
@echo off
echo Importing digital licence...
rem Define the file locations as environment variables
set DLLFILE="C:\Program Files\Microsoft CAPICOM 2.1.0.2 SDK\Lib\X86\capicom.dll"
set CSTOREFILE="C:\Program Files\Microsoft CAPICOM 2.1.0.2 SDK\Samples\vbs\CStore.vbs"
set CERTFILE="C:\Users\User\AppData\Local\Temp\MNPCertificate\Cert.p12"
set CERTPASS=****
rem Import the Cert.p12 certificate with the supplied password
cscript /nologo %CSTOREFILE% import %CERTFILE% %CERTPASS%
.vbs to call .bat from custom action:
Option Explicit
Dim objShell
Set objShell = CreateObject("WScript.Shell")
objShell.run "C:\path to file.bat"
WScript.Quit
'-------------------------------------------------- 'GET CURRENT FOLDER PATHpath = FileSystemObject.GetParentFolderName(WScript.ScriptFullName)If Right(path, 1) <> "\" Then path = path & "\"End IferrTrap = shell.Run(path, 1 ,True)If (errTrap = 0) Or (errTrap = 3010) Then 'WRITE EXIT CODE [0-success/3010-success&requires reboot] TO EVENTLOG shell.LogEvent vbLogSuccess, sLogHeader & "Installation completed successfully." & VbCrLf & "Exit code: " & errTrap WScript.Quit (errTrap)Else 'WRITE EXIT CODE TO EVENTLOGshell.LogEvent vbLogError, sLogHeader & "Installation failed." & VbCrLf & "Exit code: " & errTrap WScript.Quit (errTrap)End IfSet FileSystemObject = NothingSet Shell = Nothing'--------------------------------------------------