我想创建一个批处理文件,要求输入文件名并将其保存在FTP文件夹中

时间:2015-02-04 14:44:47

标签: batch-file

我检查了本网站上的文章丢失但无法将它们合并以获得结果。我是Batch的新手。这些年来我一直在研究VB。问题是我的办公室里没有VB。我需要使用批处理。请帮帮我。

1 个答案:

答案 0 :(得分:1)

这样的事情?

@echo off
set "ftp_server=localhost"
set "user=ftptest"
set "password=123
set "ftp_folder=."
set /p "file_to_upload=choose file"

(
echo open %ftp_server%
echo %user%
echo %password%
echo cd %ftp_folder%
echo put %file_to_upload%
echo ls
) >ftp.script
ftp -i -s:ftp.script > output.txt

选择并下载:

@echo off
set "ftp_server=localhost"
set "user=ftptest"
set "password=123
set "ftp_folder=."
set /p "file_to_upload=choose file"

(
echo open %ftp_server%
echo %user%
echo %password%
echo ls "%ftp_folder%" ls.out
) >ftp.script1
ftp -i -s:ftp.script1 > output.txt

echo files to choose:
type ls.out

set /p "file_d=choose file to download:"
find "%file_d%" "ls.out" || >nul 2>&1(
    echo file not in the list
    exit /b 1
) 

(
echo open %ftp_server%
echo %user%
echo %password%
echo %file_d% 
) >ftp.script2

ftp -i -s:ftp.script2 >> output.txt