Solved

Pass DOS Variables to vbscript

Posted on 2003-12-05
3
2,460 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
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
pbarrette earned 25 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
A short film showing how OnPage and Connectwise integration works.

914 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now