无法使用批处理脚本上传到FTP

时间:2017-12-13 01:36:07

标签: batch-file ftp

使用命令mput *将文件上传到ftp时遇到问题。当我运行批处理文件时,它显示没有找到文件。文件名有空格。

@echo off

for /F "skip=1 delims=" %%F in ('
    wmic PATH Win32_LocalTime GET Day^,Month^,Year /FORMAT:TABLE
') do (
    for /F "tokens=1-3" %%L in ("%%F") do (
        set CurrDay=0%%L
        set CurrMonth=0%%M
        set CurrYear=%%N
    )
)
set CurrDay=%CurrDay:~-2%

set CurrMonth=%CurrMonth:~-2%
echo Current day  :  %CurrDay%
echo Current month:  %CurrMonth%
echo Current year :%CurrYear%

set LOG=%CurrYear%%CurrMonth%.log
set FTPFolder=D:\FTP

echo %FTPFolder%
cd /D %FTPFolder%

ECHO.
@ECHO OFF
ftp -s:TryFTP.txt  
ECHO.
ECHO ***** FTP transfer complete successfully! *****

pause

TryFTP.txt

open Servername
user
password
lcd D:\FTP 
cd /HTML
binary
mput *
bye

我得到错误:

binary 
invalid command
mput*
file not found
bye
invalid command

但如果我使用相同的命令手动尝试它,它的工作原理。你能告诉我们它有什么问题吗?

0 个答案:

没有答案