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
srobiaAsked:
Who is Participating?
 
Tim HolmanConnect With a Mentor Commented:
Anyone there ?
0
 
Tim HolmanCommented:
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.

0
 
srobiaAuthor Commented:
Is there a better way?
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
carmineCommented:
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
0
 
Tim HolmanCommented:
afaik ?
wdik ?

I'm probably missing something here...!

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

Mark
0
 
Tim HolmanCommented:
I see...
btw - FTP's been around for nearly 30 years - the basics aren't going to change in a hurry !
0
 
carmineCommented:
nah...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.