BAT file upload using the Windows system FTP command [go]

Source: Internet
Author: User

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]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.