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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to pass multiple parameters? 1

Status
Not open for further replies.

hujirong

Technical User
Aug 22, 2005
13
CA
Hi

I need to call a remote batch file from VBScript. I try to use this:

Set MyShell = CreateObject("WScript.Shell")
MyShell.Run(???)

The program I need to call is

Program.bat -a "USD_WS" -ref "42" -sf "xxx" -sfns "yyyy" -u "id" -desc "description zzz"

How should I write this line? I don't know the format.
MyShell.Run(...)

Thanks a lot.
Jirong
 
[tt]scmd="Program.bat -a ""USD_WS"" -ref ""42"" -sf ""xxx"" -sfns ""yyyy"" -u ""id"" -desc ""description zzz"""
MyShell.Run scmd[/tt]
 
A trick I use....

1. take the command that works for you
2. paste into into a word editor (notepad)
3. do a search and replace of quotes " with 2 of them ""
4. then add quotes before and after your entire line

...it should get you in the ball park

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
It works perfect. Thank you guys very much.

Jirong
 
New question: now if I want to pass in one of parameter a variable, what's the format? I tried the following but got a "parameter" as the value, not "headline".

Jirong

Dim parameter
parameter = "headline"
Log (parameter)

scmd="C:\Temp\get_parameters.bat -a ""USD_WS"" -ref parameter -sf ""xxx"" -sfns ""yyyy"" -u ""id"" -desc ""description zzz"""
Set MyShell = CreateObject("WScript.Shell")
MyShell.Run scmd
 
scmd="C:\Temp\get_parameters.bat -a ""USD_WS"" -ref " & parameter & " -sf ""xxx"" -sfns ""yyyy"" -u ""id"" -desc ""description zzz"""

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top