简体   繁体   English

无法连接到ftp-批处理文件

[英]Cannot connect to ftp - batch file

I have simple batch file to copy multiple files to FTP. 我有简单的批处理文件,可以将多个文件复制到FTP。 I tried many things, but in dir.txt i see, that I am not at FTP server, but in Local directory. 我尝试了很多事情,但是在dir.txt中,我不是在FTP服务器上,而是在本地目录中。 Why i cannot to start ftp? 为什么我无法启动ftp? :) :)

I have 2 files: 我有2个文件:

first.bat first.bat

upload.bat > log.txt
ftp -i -s:upload.bat

upload.bat upload.bat

open myftp.myadress.com
name
password
dir >> dir.txt
cd testfolder
cd cielovy
prompt
bin
mput C:\Users\MyUser\Desktop\FTPtest\upload\*
bye

Thanks :) 谢谢 :)


After editing batch files and run, it wrotes: cmd.exe image 编辑批处理文件并运行后,它写道: cmd.exe图像

You are running a batch file to log the commands to a file log.txt , but you are calling the batch file from ftp. 您正在运行一个批处理文件以将命令记录到文件log.txt ,但是您正在从ftp调用该批处理文件。

instead try this: 而是尝试这样:

"C:\Users\MyUser\Desktop\FTPtest\upload.bat" > log.txt
cd "C:\Users\MyUser\Desktop\FTPtest\upload"
ftp -i -s:"C:\Users\MyUser\Desktop\FTPtest\log.txt"

Secondly, your batch file is wrong. 其次,您的批处理文件是错误的。 If you want to create a file for ftp -I to read you need to ensure that the commands are piped to the file for instance everything should pipe, currently you are running the commands and piping the output to log.txt 如果要创建文件以供ftp -I读取,则需要确保将命令通过管道传输到文件,例如所有内容都应通过管道传输,当前您正在运行命令并将输出通过管道传输到log.txt

echo open myftp.myadress.com
echo name
echo password
echo dir >> dir.txt  # This however will not do what you think it would.
echo cd testfolder
echo cd cielovy
echo prompt
echo bin
echo mput *
echo bye

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM