ben1211
asked on
Writing a FTP Batch File
I normally access FTP with a a batch file called FTP-Fri using the command:
%windir%\system32\ftp.exe -n -s:C:\FTP-FRI-MONTH-END.tx t
This command reads from the text file C:\FTP-FRI-MONTH-END.txt
Assuming I didn't want to read from the text file and wanted the FTP to run directly from the batch file FTP-Fri.bat
Is this possible? If it is...how do I do this? What are the commands to put into the batch file?
%windir%\system32\ftp.exe -n -s:C:\FTP-FRI-MONTH-END.tx
This command reads from the text file C:\FTP-FRI-MONTH-END.txt
Assuming I didn't want to read from the text file and wanted the FTP to run directly from the batch file FTP-Fri.bat
Is this possible? If it is...how do I do this? What are the commands to put into the batch file?
I used WINBATCH tool, this is the best for batch processes
Well. You can 'cheat' in anumber of ways. These include:
batch file like this:
goto start
open xyz
username
password
cd /whatever
get xyz.txt
quit
:start
ftp yourhost -s thisbatchfile.bat
i.e. it uses the same file for both. Bit messy.
Other way is to write a temporary text file, e.g.
@echo off
set file="%temp%\ftpfile.txt"
echo open yourserver> %file%
echo username>>%file%
echo password>>%file%
echo cd /whatever>>%file%
echo get yourfile.txt>>%file%
ftp yourhost -s %file%
del %file%
i.e. using > to create a file and >> to append each line to it.
Steve
batch file like this:
goto start
open xyz
username
password
cd /whatever
get xyz.txt
quit
:start
ftp yourhost -s thisbatchfile.bat
i.e. it uses the same file for both. Bit messy.
Other way is to write a temporary text file, e.g.
@echo off
set file="%temp%\ftpfile.txt"
echo open yourserver> %file%
echo username>>%file%
echo password>>%file%
echo cd /whatever>>%file%
echo get yourfile.txt>>%file%
ftp yourhost -s %file%
del %file%
i.e. using > to create a file and >> to append each line to it.
Steve
ASKER
dragon-it.....i am sorry, but haven't an idea what you're talking about. Please explain.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.