Link to home
Start Free TrialLog in
Avatar of doser
doserFlag for United States of America

asked on

How Do You Pass a Filename as a Variable from a Batch File to a VBScript?

I am trying to script out a process where a ZIP file gets renamed and then FTP'd.  I wrote a batch file that renames a ZIP file to include the current date and time.  I have another VBScript file to upload a specified file.  The filename is passed along fine as I tested it by running an echo and it showed the right name.  I'm stuck in the VBScript file where I'm trying to use the value of the variable with the filename as part of the file path.  The path tells the FTP application what file to upload.

The batch file has the following code to call the VBScript file:
WScript upload.vbs %name%

The VBScript has the following code to pick that up and display it to make sure it's correct:
Dim file_name
file_name = WScript.Arguments(0)
WScript.Echo file_name

I have a problem later in the script because it looks for a file named "&file_name", not the value of the variable "file_name".  My syntax is probably incorrect.:
MySite.Upload "C:\FILES\&file_name", "/WEBSITE/&file_name"

ASKER CERTIFIED SOLUTION
Avatar of JesterToo
JesterToo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of doser

ASKER

I knew it was something with my syntax, but I just couldn't figure it out.  I spent a whole day at the job working on just that part.  Thanks so much.