?
Solved

Pass DOS/Batch Variables to VBScript

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

762 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