Solved

Pass DOS/Batch Variables to VBScript

Posted on 2008-06-25
3
4,380 Views
Last Modified: 2008-07-03
I am trying to pass a variable that I created in a batch file over to a VBScript.  In the batch file, I have a filename that the VBScript will use to call an FTP program to upload.  I have the following in the batch file:
Wscript upload.vbs SOMEFILE.zip

In my VBScript, I have this so I can at least see that the value is passed along:
Dim file_name
Set file_name = WScript.Arguments("0")
WScript.Echo "file_name"

I want the VBScript to take the value in "file_name" and use that to upload the specified file.  I'm really looking to get this part fixed so I can get it out of my head.  Any help is appreciated.  Thanks.
0
Comment
Question by:doser
  • 2
3 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 21868995
my first thought is that this should be:
Set file_name = WScript.Arguments(0)
(without quotes)
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 21869010
Second thought is - specify the full path...probably not the problem, but can't hurt.

cscript c:\pathtofile\upload.vbs c:\pathtootherfile\SomeFile.zip
0
 
LVL 1

Accepted Solution

by:
doser earned 0 total points
ID: 21869652
I talked with a former boss and he helped me clear up some of my coding in my VBScript.  It should be as follows:
Dim file_name
file_name = WScript.Arguments(0)
WScript.Echo file_name
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
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…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

706 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

16 Experts available now in Live!

Get 1:1 Help Now