創建一個批處理文件是這樣的:
@echo off
echo USERNAME> upload.txt
echo PASSWORD>> upload.txt
echo asc>>upload.txt
echo put UPLOAD_FILE_NAME FTP_PATH_TO_STORE_FILE>> upload.txt
echo quit >> upload.txt
ftp -s:upload.txt SERVER_NAME.COM
del upload.txt
UPLOAD_FILE_NAME
absoulte path.Ie我需要上傳一個名爲register.exe
文件,我應該使用
echo put register.exe
,如果register.exe
是在批目錄中存在或 回聲把d:\ myfiles文件\ register.exe,如果register.exe
是在另一個文件夾中存在( myfiles文件夾在d驅動器中)
FTP_PATH_TO_STORE_FILE
: - 這是我需要放置我的文件的FTP路徑。例如/ home/myftpfolder/register。EXE
del upload.txt
: - 其可選的,因爲當執行批處理文件,這upload.txt
將與FTP用戶名和密碼的目錄存儲
如果我有我的服務器名是theserver.com
然後批處理文件應該寫這樣
@echo off
echo user123> upload.txt
echo 123TTyyy#>> upload.txt
echo asc>>upload.txt
echo put register.exe /home/myfiles/register.exe>> upload.txt
echo quit >> upload.txt
ftp -s:upload.txt theserver.com
del upload.txt
http://www.howtogeek.com/howto/windows/how-to-automate-ftp-uploads-from-the-windows-command-line/ –
感謝您的鏈接,但我誠實地嘗試了所有這些。我意識到我要求完全勺羹,但我已經認真地嘗試了幾個小時。我給了FTP帳戶信息,以便有人可以幫我填補所有空白,因爲我顯然是做錯了。另外,我不想從命令提示符上傳,我只想運行批處理文件併爲其完成 – hellohellosharp
當您從該站點運行腳本時會發生什麼情況? –