Avatar of fjkaykr11
fjkaykr11
 asked on

FTP with Batch File

From a Windows XP computer, I am looking to create a batch file to automate an FTP Login and FTP copy of multiple files at one time up to an FTP Server.
I had posted this issue before a while back but didn't get around to testing the solutions offered.
Below is the link to one of the solutions offered.   I tried the open command and got an error.  The other option uses a .scr file along with the FTP -S and FTP -N
Any ideas on how I an acomplish all within the .bat file and not have to call a .scr file?     Thanks.

http://support.microsoft.com/kb/96269

open hostname.com
user
guest
guest


It also talks about ftp -s:test.scr
and using ftp -n option as well.
Windows BatchScripting Languages

Avatar of undefined
Last Comment
Steve Knight

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Bradley Fox

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
fjkaykr11

ASKER
@mcsween thanks for the reply.  
For the ftp -n -s:file.txt where do I specify the hostname of the ftp server ?
SOLUTION
Jeff Darling

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
fjkaykr11

ASKER
@jeffld To answer your questions about DNS and Firewall. That is not the issue I can connect fine from a command prompt using FTP IP Address and then typing in the user and password.   I am confused about your parallel transfers .scr reference?  Are you saying I can't do the other method, ftp -n -s:somecommandfile.txt  in Windows?
SOLUTION
Bradley Fox

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Jeff Darling

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
fjkaykr11

ASKER
@jeffld the open command doesn't work on my system, I get an error not recognized. I am aware of the help option. thanks.

@mcsween when I tried to follow your steps, I get an error invalid command for the login username, any ideas?
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
SOLUTION
Jeff Darling

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Steve Knight

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
fjkaykr11

ASKER
@jeffld. I think I am missing something here.
If I type in open ftpserver ip I get an error.
Don't I need to type FTP first?
like
FTP Open ip address ?
If I do this manually and I type FTP, then I get an FTP prompt, then I can type in
Open FTP Server ok.  But I still am lost at how to accomplish this within a Batch File.
SOLUTION
Jeff Darling

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
fjkaykr11

ASKER
@dragon-it thanks for the info.  When I tried your method the command prompt pops up and is stuck waiting for an input of the password (like below)

password:
SOLUTION
Jeff Darling

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Steve Knight

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Jeff Darling

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Jeff Darling

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
fjkaykr11

ASKER
I was able to get this done finally with adjusting @mcsween's method (see below for what worked).  Thanks.
FTP Batch File Command: ftp -i -n -s:file.txt FTPServerIP

file.txt file info
username
username
password
cd UploadDirectory
mput *
quit
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Steve Knight

Yes, some servers work with one, some the other but they all should work with one of them.

Steve