Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ShellExecute Multiple Parameters

Status
Not open for further replies.

witchblade

Programmer
Aug 1, 2001
50
0
0
US
Does anyone have an example of how to pass multiple parameters with ShellExecute??

I can't get it to accept multiple parameters without using a continuous string.

[gorgeous]
 
i have tried and all i could come up with is what you have already suggest

str2run = "cmd /c %FSCDRIVE% && CD \ && CD " & strWrapperLoc & " && wrapper.vbs %FSCDRIVE%\Siebel\SiebelClient\V2.60_ml\_Script\MAN-SiebelClient-V2.60-" & strLangVersion & ".ini"
'msgbox str2run
a = WshShell.Run (str2run, 1)

had to do the above as the app which accepts the ini file moans if you dont change your working directory
 
Here are 2 example snippets I use when I have multiple parameters.

'**********************************
' Use this method when I have to put a parameter in ""
mid = """C:\Program Files\FormFlow\Uninst.isu"""
strRemove = "C:\WINDOWS\IsUninst.exe -f" & mid & " -s -a -s"

RemoveOldVer (strRemove) 'Sample RemoveOldVer below
'****************************************

'Use this when all you have to deal with are spaces
InstallIt ("msiexec.exe /I " & SrcDir & "\AccelioCaptureAdvancedEndUserComponents.msi REMOVE=ALL /qb")
'*****************************************

'Sample RemoveIt
Sub RemoveOldVer (strRemove)
Dim Exec, oExec
Exec = strRemove
Set oExec = oWsh.Exec (Exec)
Do While oExec.Status =0
Wscript.Sleep (100)
Loop
Set oExec = Nothing
End Sub
'*****************************************

'Sample InstallIt
' This varies depending upon whether I can use Exec or have to use Run

Sub InstallIt(n1)
Dim ExecStr, oExec
ExecStr = n1
' InstallIt = oWsh.Run (ExecStr , 1, True)

Set oExec = oWsh.Exec(ExecStr)
Do While oExec.Status =0
Wscript.Sleep (100)
Loop
Set oExec = Nothing
End Sub

'Good Luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top