?
Solved

Pass DOS Variables to vbscript

Posted on 2003-12-05
3
Medium Priority
?
2,469 Views
Last Modified: 2009-12-16
Is there a way to pass a variable through a command line to a vbscript file.

I have a script that counts how many records are in a file.  I want to pass a count to the vbscript to compare these two.

Something Like:

download.bat executes count.vbs 225

count.vbs the reads 225.

Is this possible or am I going to have to have the batch file write a file and then have the vbscript read the file.
0
Comment
Question by:1Adam12
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
pbarrette earned 100 total points
ID: 9883461
Hi 1Adam12,

This really isn't a DOS variable issue. It's actually a vbscript issue.

You need to use something like this in your vbscript:
WScript.Arguments(0)

This should read in the first passed argument. In your example above, "WScript.Arguments(0)" would return "225".

Hope this helps,
pb
0
 

Author Comment

by:1Adam12
ID: 9883722
WScript.Arguments("0") worked.

Thanks!
0
 
LVL 10

Expert Comment

by:pbarrette
ID: 9884642
Hi 1Adam12,

Glad to help.

pb
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using dates in 'DOS' batch files has always been tricky as it has no built in ways of extracting date information.  There are many tricks using string manipulation to pull out parts of the %date% variable or output of the date /t command but these r…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question