We help IT Professionals succeed at work.

FTP Script

srobia
srobia asked
on
195 Views
Last Modified: 2013-12-28
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
Comment
Watch Question

CERTIFIED EXPERT

Commented:
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.

Author

Commented:
Is there a better way?

Commented:
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
CERTIFIED EXPERT

Commented:
afaik ?
wdik ?

I'm probably missing something here...!

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

Mark
CERTIFIED EXPERT

Commented:
I see...
btw - FTP's been around for nearly 30 years - the basics aren't going to change in a hurry !
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Commented:
nah...
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.