批处理脚本中的FTP命令无法正常工作 [英] FTP commands in a batch script does not working properly
问题描述
我制作了一个简单的FTP上传脚本,应该将多个文件从Windows 2008 Server上传到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:\test\test\
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%\desktop\ftpscript.txt"
pause
这篇关于批处理脚本中的FTP命令无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!