BAT file upload using Windows system FTP command upload [goto] BAT file uploads with Windows system FTP command [go]
In the development often need to upload local programs to the server, and used to the Linux command of the people. It's a bit cumbersome under Windows. For the convenience of writing a bat program to help people who need such functionality. If you have the FTP feature that comes with other IDE tools, ^_^!
Command: todev.bat/index.asp default d:\cnweb is the root directory of the Web site.
My http://www.lawcar.cn/http://www.myitcar.com/http://www.stockcar.cn/http://www.lunwencar.com/is maintained by this way.
@IF"%"==""GotoError_parm
@IF"%"==""GotoError_parm
@SETLOCAL
@SetServer=192.168.10.199
@SetUsername=
@SetPassword=
@echo whether to upload D:\Cnweb\%1\%2to the DEV server!
@echo off
CHOICE/C YN/M"Confirm Please press Y, no please press N to exit"
IfErrorlevel255GotoNo
IfErrorlevel2GotoNo
IfErrorlevel1GotoYes
: No
@echoOn
@echo didn't upload any files to dev.
@GotoEnd
: Yes
IFNotEXIST D:\Cnweb\%1\%2GotoError2
Echo Open%server%>Ftp.txt
echo User%username%>>Ftp.txt
Echo%password%>>Ftp.txt
Echo CD%1>>Ftp.txt
echo bye>>Ftp.txt
Ftp-S:ftp.txt-n | Find"550"
IfNotErrorlevel1@GotoError
RemDel Ftp.txt Ftperror.txt
Echo Open%server%>Ftp.txt
echo User%username%>>Ftp.txt
Echo%password%>>Ftp.txt
Echo CD%1>>Ftp.txt
Echo put D:\Cnweb\%1\%2>>Ftp.txt
echo bye>>Ftp.txt
Ftp-S:ftp.txt-n | Find"Invalid"
IfNotErrorlevel1@GotoError3
RemDel Ftp.txt Ftperror.txt
@echoOn
@echo Upload dev complete.
@GotoPutok
:Error
@echo Server Directory error%1
RemDel Ftp.txt Ftperror.txt
@GotoEnd
: Error2
@echo Local directory error d:\cnweb\%1
@del ftp.txt ftperror.txt
@goto end
: Error3
@echo upload file error d:\cnweb\%1\%2del ftp.txt ftperror.txt@goto end:putok@echo Upload Successful %1 %2 ! @rem del ftp.txt ftperror.txt@goto end:error_parm@echo parameter error, correct format: todev Relative path file name @goto end:end@echo bye. @ENDLOCAL
Bat file upload using the Windows system FTP command [go]