srobia
asked on
FTP Script
Hello,
I'm trying to write a .bat based application that will FTP get some files from another machine. First question, is it possible to use an environment variable in a .scr file? Here is what I'm doing:
set %filename% = example.log
FTP -n -s:doffus.scr <host>
While in the doffus.scr:
get /<location>/%filename%
Second question, would you do it this way, or is there a better way? I would like to use the .bat approach.
Thanks
I'm trying to write a .bat based application that will FTP get some files from another machine. First question, is it possible to use an environment variable in a .scr file? Here is what I'm doing:
set %filename% = example.log
FTP -n -s:doffus.scr <host>
While in the doffus.scr:
get /<location>/%filename%
Second question, would you do it this way, or is there a better way? I would like to use the .bat approach.
Thanks
ASKER
Is there a better way?
I don't think so. It is the cmd.exe that expands the environment variables, ftp.exe doesn't understand them, so you have to use Tims solution (afaik - but then wdik?).
Mark
Mark
afaik ?
wdik ?
I'm probably missing something here...!
wdik ?
I'm probably missing something here...!
'as far as i know' you're not missing anything. But then 'what do i know'?
Mark
Mark
I see...
btw - FTP's been around for nearly 30 years - the basics aren't going to change in a hurry !
btw - FTP's been around for nearly 30 years - the basics aren't going to change in a hurry !
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
nah...
If you're having problems, you could pipe %filename% to a file - eg in a batch file :
@echo off
echo get /<location>/%%filename%% > doffus.scr
FTP -n -s:doffus.scr
so then FTP wouldn't actually be trying to use an environment variable.