批处理脚本中的 FTP 命令无法正常工作 [英] FTP commands in a batch script does not working properly
问题描述
我制作了一个简单的 FTP 上传脚本,它应该将多个文件从 Windows 2008 服务器上传到 FTP 位置.我已经通过直接在 CMD 中执行脚本的每个命令来手动尝试这个,它工作正常.但是,当我运行 script.bat 时,它说没有任何命令被识别为内部或外部命令.我检查了 ENV 变量,并且有一条到 System32 的路径,所以应该没问题.谁能帮忙解决这个问题.谢谢你
I've made a simple FTP upload script that should upload multiple files from a Windows 2008 Server to the FTP location. I've tried this manually by executing every command of the script directly in CMD and it works fine. However when I run script.bat it says that none of the commands are recognized as internal or external commands. I checked the ENV variables and there is a path to System32 so it should be fine. Can anyone please help with this. Thank you
open xx.xxx.xx.xx
user
pass
prompt
bin
lcd X: est est
cd /tempTest/tempTest
binary
mput "*.*"
disconnect
quit
推荐答案
将您的脚本放在桌面上名为 ftpscript.txt
Place your script in a text file on your desktop called ftpscript.txt
创建一个名为 getftp.bat
的批处理文件,其中包含该文件 - 然后您可以单击该 bat 文件.
Create a batch file called getftp.bat
and inside it have this - then you can click the bat file.
@echo off
ftp -i -s:"%userprofile%desktopftpscript.txt"
pause
这篇关于批处理脚本中的 FTP 命令无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!