Link to home
Start Free TrialLog in
Avatar of srobia
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
Avatar of Tim Holman
Tim Holman
Flag of United Kingdom of Great Britain and Northern Ireland image

Does it work ?

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.

Avatar of srobia
srobia

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
afaik ?
wdik ?

I'm probably missing something here...!

'as far as i know' you're not missing anything. But then 'what do i know'?

Mark
I see...
btw - FTP's been around for nearly 30 years - the basics aren't going to change in a hurry !
ASKER CERTIFIED SOLUTION
Avatar of Tim Holman
Tim Holman
Flag of United Kingdom of Great Britain and Northern Ireland 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
nah...