Solved

Pass DOS/Batch Variables to VBScript

Posted on 2008-06-25
3
4,400 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
[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 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Can I extract an application from MS-DOS and transfer it to Windows 7? 16 80
OS Selection Menu 1 70
Odd Coloration 4 25
Merging text files strings with filename 18 46
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

730 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