How do you pass parameters from a batch file to a VBS file 
Author Message
 How do you pass parameters from a batch file to a VBS file

I'm very new to VBScript (I have only tried to use it
within the last 4 hours).

I need to be able to pass in parameters from a command
line and then have a VBS file use these parameters when
processing.

I'd appreciate a sample batch and VBS file if possible.

TIA

Scott Huerta
Distinctive Solutions Corporation



Sat, 15 Oct 2005 08:38:22 GMT  
 How do you pass parameters from a batch file to a VBS file

Quote:

> I'm very new to VBScript (I have only tried to use it
> within the last 4 hours).

Yeah, but translating from Internet time to people time that's 4 _years_.
;)

Quote:
> I need to be able to pass in parameters from a command
> line and then have a VBS file use these parameters when
> processing.

Get the WSH documentation - go to http://www.microsoft.com/downloads and
pick "Windows Script" from the dropdown; the Windows Script Docs are
available under there.  You'll find it useful for looking up some details
of this as you go.

I'm not sure what you are wanting to do precisely, but here's a simple
"intro" to using arguments with WSH scripts.

You supply arguments to the WSH script just like you would any
application.  WSH-hosted scripts automatically have a WScript.Arguments
collection exposed which contains all of the arguments supplied to the
script. So for example let's take a script named test.vbs that looks like
this:

'test.vbs
for each arg in WScript.Arguments
    wscript.echo arg
next

The arguments collection correctly parses quoted arguments; if you run the
script with the following command line:

    cscript test.vbs a "second argument" thirdArg "4th Arg"

you will get the following output:

Arg1
second argument
thirdArg
4th Arg

Quote:
> I'd appreciate a sample batch and VBS file if possible.

> TIA

> Scott Huerta
> Distinctive Solutions Corporation

--
Please respond in the newsgroup so everyone may benefit.
 http://dev.remotenetworktechnology.com
(email requests for support contract information welcomed)
 ----------
 Microsoft's new UNIFIED Terminal Services Newsgroup:



Sat, 15 Oct 2005 11:04:35 GMT  
 How do you pass parameters from a batch file to a VBS file

Thanks for the sample.  I'll give it a try.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Sat, 15 Oct 2005 23:48:17 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Passing parameters to a batch file from a vb script

2. Pass a parameter to a DOS batch file?

3. How can i pass parameters to a VBScript (files *.vbs)

4. passing a parameter to a VBS file

5. Passing parameters to .Vbs files

6. How can i pass parameters to a VBScript (files *.vbs)

7. Passing parameters to a .vbs-file?

8. How do I pass a command-line parameter to my vbs file

9. How can i pass parameters to a VBScript (files *.vbs)

10. Pass parameters to a vbs file

11. Passing parameters to vbs file

12. how to execute a batch file into a VBS file

 

 
Powered by phpBB® Forum Software