Vbscript - Run an Executable w/ arguments

This hopefully should be easy, but it's been years since I've scripted anything .  WHat I am tryign to do - prompt users for an IP address, then pass that IP address to a simple executable.

The syntax at the cli is flash.exe -s <IPADDRESS>

Dim objshell, strSwitchIP
strSwitchIP = InputBox ("Entrer IP Address")
Set objshell = Wscript.CreateObject ("Wscript.Shell")
objshell.run("""c:\flash.exe"" -s strSwitchIP""" 
Set objshell = Nothing

Open in new window


Am I on the right track?  I assume the issue is syntax with the quotes?  Or is this not really possible?
LVL 1
JamesonJendreasAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dustockCommented:
Line 4 is missing the closing parenthesis

should be like this
objshell.run("""c:\flash.exe"" -s strSwitchIP""")

Open in new window

JamesonJendreasAuthor Commented:
Grr, that what I get for not copy/paste (its in a VM).   I actually have the closing ) on my actual script
Dim objshell, strSwitchIP
strSwitchIP = InputBox ("Entrer IP Address")
Set objshell = Wscript.CreateObject ("Wscript.Shell")
objshell.run("""c:\flash.exe"" -s strSwitchIP""")
Set objshell = Nothing

Open in new window

Dim objshell, strSwitchIP
strSwitchIP = InputBox ("Entrer IP Address")
Set objshell = Wscript.CreateObject ("Wscript.Shell")
objshell.run("""c:\flash.exe"" -s strSwitchIP""")
Set objshell = Nothing
oBdACommented:
Since there are no spaces in the exe path or the arguments, you wouldn't actually need any escaped or ASCII-encoded quotes at all.
Dim objshell, strSwitchIP
strSwitchIP = InputBox ("Entrer IP Address")
Set objshell = Wscript.CreateObject ("Wscript.Shell")
objshell.run("c:\flash.exe -s " & strSwitchIP)
Set objshell = Nothing

Open in new window

Here's an example how it could look with a space in the path and quotes around the IP address:
Dim objshell, strSwitchIP
strSwitchIP = InputBox ("Entrer IP Address")
strExe = "C:\Some Path\Flash.exe"
strArguments = " -s " & Chr(34) & strSwitchIP & Chr(34)
Set objShell = WScript.CreateObject("WScript.Shell")
strCommand = chr(34) & strExe & chr(34) & strArguments
objShell.Run strCommand, 1, True

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.