Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Pass DOS/Batch Variables to VBScript

Posted on 2008-06-25
3
Medium Priority
?
4,441 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

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

It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses
Course of the Month21 days, 7 hours left to enroll

810 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