2016-11-11 177 views
1

我一直使用.bat腳本從FTP服務器下載PDF文件。Serverside FTP批處理腳本

到目前爲止,它一直在使用mget * pdf功能完美工作。

我最近移動了該腳本,並從Windows 2012 Server運行它。

現在,當腳本到達mget函數時,它會列出除了使用?在每個實例之後,然後實際上將它們下載到液晶顯示器上。

@ftp -v -n -i -s:C:\Users\LMCT\Desktop\Serversidesage\download-1.txt 

這是被稱爲FTP功能。

open xx.xxx.xx.xxx 
user xxxxxxxxxxx 
=xxxxxxxxxxxx 
cd orders 
lcd "C:\Users\LMCT\Desktop\Magento-downloaded-orders" 
binary 
prompt 
mget *pdf 
mdelete *pdf 
quit 

這是下載腳本。

有誰知道爲什麼會發生這種情況?

在此先感謝。

親切的問候,劉易斯。

+1

從執行中除去'-v',這樣就可以看到發生了什麼。 – Squashman

+0

這樣做並沒有透露任何新​​東西。 – LewisMCT333

+1

當運行腳本時,向我們顯示FTP命令的所有輸出,而不使用-v。 – Squashman

回答

2

默認情況下,交互式提示已打開。當您使用-I選項啓動FTP命令時,它將關閉「提示」。在你的腳本中,然後使用PROMPT命令將它重新打開,然後拋出MGET命令。

所以如果提示命令是在你的FTP腳本:

open ftp.domain.com 
user ftpuser 
password 
prompt 
quit 

這是很容易測試,看看到底是怎麼回事。

C:\BatchFiles\ftp>ftp -v -i -n -s:"script.txt" |find "Interactive" 
Interactive mode On . 

C:\BatchFiles\ftp>ftp -v -n -s:"script.txt" |find "Interactive" 
Interactive mode Off .