China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-04 12:09
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to use a batch file to automatically log in to an FTP website and upload files View 2,905 Replies 4
Original Poster Posted 2004-06-03 00:00 ·  中国 北京 光环新网电信数据中心
初级用户
Credits 108
Posts 2
Joined 2004-06-03 00:00
22-year member
UID 25953
Gender Male
Status Offline
How to use a batch file to automatically log in to an FTP website and upload files via FTP
Floor 2 Posted 2004-06-03 00:00 ·  中国 河北 石家庄 联通
铂金会员
★★★★
网络独行侠
Credits 6,962
Posts 2,753
Joined 2003-04-16 00:00
23-year member
UID 1565
Gender Male
From 河北保定
Status Offline
I will take the FTP command of Windows 2003 as an example. Entering ftp -h, you can see the help:

Transfers files to and from a computer running an FTP server service
(sometimes called a daemon). Ftp can be used interactively.

FTP

-v Suppresses display of remote server responses.
-n Suppresses auto-login upon initial connection.
-i Turns off interactive prompting during multiple file
transfers.
-d Enables debugging.
-g Disables filename globbing (see GLOB command).
-s:filename Specifies a text file containing FTP commands; the
commands will automatically run after FTP starts.
-a Use any local interface when binding data connection.
-A login as anonymous.
-x:send sockbuf Overrides the default SO_SNDBUF size of 8192.
-r:recv sockbuf Overrides the default SO_RCVBUF size of 8192.
-b:async count Overrides the default async count of 3
-w:buffer size Overrides the default transfer buffer size of 65535.
host Specifies the host name or IP address of the remote
host to connect to.

Notes:
- mget and mput commands take y/n/q for yes/no/quit.
- Use Control-C to abort commands.

You must have noticed the description of the -s:filename parameter.

Create a script.txt on the hard disk with the following content:
open
anonymous
user@the.net
cd public
put test.txt
bye

Note: The above is just an example, please modify it according to the actual situation.

Then run the command:
ftp -s:script.txt
偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
Floor 3 Posted 2006-09-18 04:01 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
Hehe, I've always wanted to use a batch script to automatically log in to my FTP, and没想到 it can be done automatically. I agree with the person on the 2nd floor...
Floor 4 Posted 2007-05-06 19:19 ·  中国 上海 宝山区 电信
新手上路
Credits 2
Posts 1
Joined 2007-05-06 14:46
19-year member
UID 87669
Gender Male
Status Offline
Why did it happen when I followed the above prompts?
Transfers files to and from a computer running an FTP server service
(sometimes called a daemon). Ftp can be used interactively.

FTP

-v Suppresses display of remote server responses.
-n Suppresses auto-login upon initial connection.
-i Turns off interactive prompting during multiple file
transfers.
-d Enables debugging.
-g Disables filename globbing (see GLOB command).
-s:filename Specifies a text file containing FTP commands; the
commands will automatically run after FTP starts.
-a Use any local interface when binding data connection。
-A login as anonymous.
-x:send sockbuf Overrides the default SO_SNDBUF size of 8192.
-r:recv sockbuf Overrides the default SO_RCVBUF size of 8192.
-b:async count Overrides the default async count of 3
-w:buffer size Overrides the default transfer buffer size of 65535.
host Specifies the host name or IP address of the remote
host to connect to.

Notes:
- mget and mput commands take y/n/s for yes/no/quit.
- Use Control-C to abort commands.

You must have noticed the description of the -s:filename parameter.

Create a script.txt on the hard drive with the following content:
open
anonymous
user@the.net
cd public
put test.txt
bye
My FTP server is set up with SERV-U!
Floor 5 Posted 2007-05-07 08:32 ·  中国 甘肃 张掖 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
Forum Jump: