/build/static/layout/Breadcrumb_cap_w.png

How to call xxxx.msi in vbscript.

Hi Experts,

Please can anyone help me to call "c:\test\xxx.msi" in vbscript.


i found the scenorios :


On Error Resume Next
Set sho = Wscript.CreateObject("Wscript.Shell")
strCurrentDir = Left(Wscript.ScriptFullName, (InstrRev(Wscript.ScriptFullName, "\") -1))
strCommand = "msiexec.exe /i " & chr(34) & strCurrentDir & "\widgets.msi" & chr(34) &_
" TRANSFORMS=" & chr(34) & strCurrentDir & "\widgets.mst" & chr(34) &_
" REBOOT=ReallySuppress /l*v c:\wdgt.log /qb-!"
intRet = sho.run(strCommand,0,True)
wscript.quit(intRet)


and


ScriptPath = Left(WScript.ScriptFullName, Len(WScript.ScriptFullName) - Len(WScript.ScriptName))
AppName = "AcroStan.msi"
Return = WshShell.Run("msiexec/i" chr(34) & ScriptPath &AppName &chr(34) "/qb!", 1, True)

Note: here how can i replicate my path as c:\test\xxx.msi

Thanks in advance.
Sourav.

0 Comments   [ + ] Show comments

Answers (2)

Posted by: anonymous_9363 15 years ago
Red Belt
0
- One, your post really ought to be in the 'Scripts' forum;
- Two,
- create C:\TEST
- drop the script and MSI into C:\TEST

Both scripts use the name of the folder which contains the script to build a variable and then use the variable in the command line.
Posted by: captain_planet 15 years ago
Black Belt
0
Here's an adaptation of your code above. Edit the variable values accordingly. If you're not using a transform, just remove the line starting with '" TRANSFORMS' (and the blank line that it leaves behind once it's deleted)


On Error Resume Next
Set sho = Wscript.CreateObject("Wscript.Shell")
Dim intRet
'specify name of msi (without extension)
Dim msiname : msiname = "xxx"
'specify name of mst (without extension)
Dim mstname : mstname = "xxx"
'specify name of log (without extension)
Dim logname : logname = "xxxlog"
'specify location of msi
Dim strCurrentDir : strCurrentDir = "c:\test"
'specify msiexec.exe command line
Dim strCommand : strCommand = "msiexec.exe /i " & chr(34) & strCurrentDir & "\" & msiname & ".msi" & chr(34) &_
" TRANSFORMS=" & chr(34) & strCurrentDir & "\" & mstname & ".mst" & chr(34) &_
" REBOOT=ReallySuppress /l*v " & chr(34) & strCurrentDir & "\" & logname & ".log" & chr(34) & " /qb-!"
'run command
intRet = sho.Run(strCommand,0,True)
'return exit code
wscript.Quit(intRet)
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ