[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 334
  • Last Modified:

Passing variable from CMD to VBS

I'm launching a .vbs script by calling it from the command prompt. I'd like for the command prompt to pass a variable to the .vbs file. Is this possible? If so, how?
0
Darkejo1
Asked:
Darkejo1
1 Solution
 
chrismerrittCommented:
0
 
rejoinderCommented:
In the VBScript part you would add something like this.
From the batch file you would write out the entry like this...
wscript my-vb-file.vbs "Test"
The "Test" is the parameter being passed.
Dim objArgs
Set objArgs = Wscript.Arguments
wscript.echo objArgs(0)

Open in new window

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now