I am having problem running ftp commands from a batch file.
Ruuning through command works OK but when I run from my batch file the
cmd windows just loops through. I am sure this is a simple fix
because it works manually. You may have guessed I do not know too
much about batch files.
Batch File
@echo
ftp -i -n -s:ftp.txt
CSL
EXIT
Text File for FTP
open my_ipaddress
myuser
mypassword
cd mydir
mget *.txt c:\*.*
quit
Any ideas :-(
>when I run from my batch file the
>cmd windows just loops through.
You didn't name your batch file "ftp.bat", did you?
--
RoRo
Hi,
It seems there are several ways. I�m not so sure what -n does. Here�s
How i do it
My Batchfile looks like this (it�s called getit.bat)
ftp -i -s:ftp.dat
Here now what�s inside that ftp.dat (variables start with _ and have to
be changed to your commands)
open _ip
_username
_password
_command-1
_command-2
bin
bye
exit
before i begin a binary transfer i switch to binary mode with the
command bin ... don�t know if mget implies bin
regarding mget *.txt c:\*.*
regarding your CSL command i guess you meant to write CLS ... right ?
I would suggest to be carefull with that command ... at least
give it a good testperiod :) i know what i�m talking about
If your batchfile is called ftp.bat you need to change
ftp -i -s:ftp.dat to %SystemRoot%\system32\ftp.exe -i -s:ftp.dat
assuming you are using XP ... so it won�t loop
Andrew
Thanks everyone, renaming the ftp.bat and worked great, just so I can
understand the problem what was the issue with calling file ftp.bat
Neill
> Thanks everyone, renaming the ftp.bat and worked great, just so I can
> understand the problem what was the issue with calling file ftp.bat
>
> Neill
by calling it ftp.bat it worked as a loop. Since you want to run a file
name ftp(exe) the OS first looks (what you got in your batchfile) inside
the folder it resides. Then it follows the PATH
Maybe you wanna check out wikipedia for more info :) i�m too lazy to
write it all down right now :)
Andrew
Simply adding .exe to the ftp command will prevent the loop.
ftp.exe -i -n -s:ftp.txt
However, it is a good practice to avoid using the same name as utilities. In
this case, a better name for the batch would have been
Download_txt_files.bat
--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)
> Simply adding .exe to the ftp command will prevent the loop.
only if it can be found true the path statement :)
using %SystemRoot%\system32\ftp.exe would be my choice
Andrew
That is a different issue from the batch restarting in a loop. The point
was, when ftp.exe is specified, ftp.bat in current folder will not be run by
mistake.
>
> using %SystemRoot%\system32\ftp.exe would be my choice
No comment on personal preferences.