Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Pass DOS Variables to vbscript

Posted on 2003-12-05
3
Medium Priority
?
2,470 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

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…
TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

636 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