skip to main
|
skip to sidebar
Sailing with breeze
My Mnemosyne.
Thursday, May 03, 2007
[ftp]利用windows系统ftp命令编写的BAT文件上传
在开发中往往需要将本地的程序上传到服务器,而且用惯了linux命令的人来说。在windows下就比较麻烦了。为了方便特编写一个BAT程序来帮助需要这样功能的人。如果用其他IDE工具自带的FTP功能也可以,^_^!
命令: todev.bat /index.asp 默认d:\cnweb为网站的根目录。
我的
www.lawcar.cn
www.myitcar.com
www.stockcar.cn
www.lunwencar.com
都是靠这样的方法维护。
@
IF
"
%1
"
==
""
goto
error_parm
@
IF
"
%2
"
==
""
goto
error_parm
@SETLOCAL
@
set
server
=
192.168
.
10.199
@
set
username
=
@
set
password
=
@echo 是否上传 d:
\
cnweb
\
%
1
\
%
2
到dev服务器!
@echo off
CHOICE
/
C YN
/
M
"
确认请按 Y,否请按N退出
"
if
errorlevel
255
goto
no
if
errorlevel
2
goto
no
if
errorlevel
1
goto
yes
:no
@echo
on
@echo 没有任何文件上传到DEV.
@
goto
end
:yes
IF
not
EXIST d:
\
cnweb
\
%
1
\
%
2
goto
error2
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
"
if
not
errorlevel
1
@
goto
error
rem
del 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
"
if
not
errorlevel
1
@
goto
error3
rem
del ftp.txt ftperror.txt
@echo
on
@echo 上传DEV完成.
@
goto
putok
:
error
@echo 服务器目录错误 %
1
rem
del ftp.txt ftperror.txt
@
goto
end
:error2
@echo 本地目录错误 d:
\
cnweb
\
%
1
@del ftp.txt ftperror.txt
@
goto
end
:error3
@echo 上传文件错误 d:
\
cnweb
\
%
1
\
%
2
del ftp.txt ftperror.txt
@
goto
end
:putok
@echo 上传成功 %
1
%
2
!
@
rem
del ftp.txt ftperror.txt
@
goto
end
:error_parm
@echo 参数错误,正确格式: todev 相对路径 文件名
@
goto
end
:
end
@echo Bye.
@ENDLOCAL
Newer Post
Older Post
Home
About Me
Unknown
View my complete profile
loki's shared items
Blog Archive
►
2015
(3)
►
07/05 - 07/12
(1)
►
02/08 - 02/15
(1)
►
01/04 - 01/11
(1)
►
2014
(9)
►
12/28 - 01/04
(1)
►
12/21 - 12/28
(1)
►
12/14 - 12/21
(1)
►
12/07 - 12/14
(1)
►
11/30 - 12/07
(1)
►
09/28 - 10/05
(1)
►
09/21 - 09/28
(3)
►
2009
(1)
►
01/11 - 01/18
(1)
►
2008
(104)
►
11/09 - 11/16
(1)
►
11/02 - 11/09
(1)
►
10/26 - 11/02
(5)
►
10/19 - 10/26
(3)
►
10/05 - 10/12
(6)
►
09/28 - 10/05
(6)
►
09/14 - 09/21
(1)
►
09/07 - 09/14
(1)
►
08/24 - 08/31
(2)
►
08/17 - 08/24
(2)
►
08/10 - 08/17
(3)
►
08/03 - 08/10
(11)
►
07/20 - 07/27
(6)
►
07/13 - 07/20
(4)
►
07/06 - 07/13
(1)
►
06/29 - 07/06
(1)
►
06/15 - 06/22
(1)
►
06/08 - 06/15
(5)
►
05/18 - 05/25
(1)
►
05/11 - 05/18
(4)
►
05/04 - 05/11
(5)
►
04/27 - 05/04
(3)
►
04/06 - 04/13
(4)
►
03/30 - 04/06
(1)
►
03/23 - 03/30
(2)
►
03/09 - 03/16
(2)
►
03/02 - 03/09
(9)
►
02/24 - 03/02
(2)
►
02/17 - 02/24
(3)
►
02/10 - 02/17
(2)
►
01/20 - 01/27
(1)
►
01/13 - 01/20
(3)
►
01/06 - 01/13
(2)
▼
2007
(94)
►
12/30 - 01/06
(1)
►
12/16 - 12/23
(1)
►
12/09 - 12/16
(2)
►
11/25 - 12/02
(1)
►
11/18 - 11/25
(6)
►
11/11 - 11/18
(1)
►
11/04 - 11/11
(3)
►
10/28 - 11/04
(1)
►
10/21 - 10/28
(3)
►
09/09 - 09/16
(1)
►
08/12 - 08/19
(1)
►
07/22 - 07/29
(1)
►
07/15 - 07/22
(3)
►
07/08 - 07/15
(4)
►
07/01 - 07/08
(2)
►
06/24 - 07/01
(3)
►
06/17 - 06/24
(1)
►
06/03 - 06/10
(4)
►
05/27 - 06/03
(2)
►
05/20 - 05/27
(6)
►
05/13 - 05/20
(9)
►
05/06 - 05/13
(8)
▼
04/29 - 05/06
(2)
windows下面自动下载ftp上东东的脚本
[ftp]利用windows系统ftp命令编写的BAT文件上传
►
04/22 - 04/29
(1)
►
03/11 - 03/18
(3)
►
03/04 - 03/11
(6)
►
02/25 - 03/04
(4)
►
02/18 - 02/25
(9)
►
02/11 - 02/18
(1)
►
01/21 - 01/28
(3)
►
01/14 - 01/21
(1)
►
2006
(76)
►
12/31 - 01/07
(5)
►
12/24 - 12/31
(2)
►
12/17 - 12/24
(2)
►
12/10 - 12/17
(4)
►
12/03 - 12/10
(17)
►
11/26 - 12/03
(6)
►
11/12 - 11/19
(4)
►
11/05 - 11/12
(4)
►
10/29 - 11/05
(5)
►
10/22 - 10/29
(5)
►
10/15 - 10/22
(1)
►
10/08 - 10/15
(1)
►
09/24 - 10/01
(1)
►
09/17 - 09/24
(2)
►
09/10 - 09/17
(3)
►
09/03 - 09/10
(2)
►
08/27 - 09/03
(3)
►
08/13 - 08/20
(3)
►
08/06 - 08/13
(3)
►
07/30 - 08/06
(1)
►
07/23 - 07/30
(1)
►
07/02 - 07/09
(1)
Links
Google News