How Do You Pass a Filename as a Variable from a Batch File to a VBScript?
Posted on 2008-06-25
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:
file_name = WScript.Arguments(0)
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"