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-06-24 05:10
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Recommended][Win] Nothing better to do - Notes on using BAT to implement file download functionality DigestI View 7,943 Replies 7
Original Poster Posted 2006-06-03 21:42 ·  中国 山西 临汾 中移铁通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 2 Posted 2006-06-04 10:56 ·  中国 四川 成都 联通
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
Bump! Learning PE will still take some time; my fundamentals still aren't enough!

P.S.: Using bat+vbs with xmlhttp can easily download files!, or wget/ftp works too!

Posting one here:

@echo off
cls
echo download start

echo download ...
rem 1. dl.vbs
echo with wscript:if .arguments.count^<2 then .quit:end if >dl.vbs
echo set aso=.createobject("adodb.stream"):set web=createobject("microsoft.xmlhttp") >>dl.vbs
echo web.open "get",.arguments(0),0:web.send:if web.status^>200 then quit >>dl.vbs
echo aso.type=1:aso.open:aso.write web.responsebody:aso.savetofile .arguments(1),2:end with >>dl.vbs
cscript dl.vbs http://www.baidu.com/img/slogo.gif 1.gif
del dl.vbs

echo download ...
rem 2. iget.vbs
echo iLocal = LCase(WScript.Arguments(1)) >iget.vbs
echo iRemote = LCase(WScript.Arguments(0)) >>iget.vbs
echo Set xPost = createObject("Microsoft.XMLHTTP") >>iget.vbs
echo xPost.Open "GET",iRemote,0 >>iget.vbs
echo xPost.Send() >>iget.vbs
echo Set sGet = createObject("ADODB.Stream") >>iget.vbs
echo sGet.Mode = 3 >>iget.vbs
echo sGet.Type = 1 >>iget.vbs
echo sGet.Open() >>iget.vbs
echo sGet.Write(xPost.responseBody) >>iget.vbs
echo sGet.SaveToFile iLocal,2 >>iget.vbs
cscript iget.vbs http://www.baidu.com/img/slogo.gif 2.gif
del iget.vbs

echo download ...
rem 3. dsa.vbs
echo Set xPost = createObject("Microsoft.XMLHTTP") >dsa.vbs
echo xPost.Open "GET","http://www.baidu.com/img/slogo.gif",0 >>dsa.vbs
echo xPost.Send() >>dsa.vbs
echo Set sGet = createObject("ADODB.Stream") >>dsa.vbs
echo sGet.Mode = 3 >>dsa.vbs
echo sGet.Type = 1 >>dsa.vbs
echo sGet.Open() >>dsa.vbs
echo sGet.Write(xPost.responseBody) >>dsa.vbs
echo sGet.SaveToFile "3.gif",2 >>dsa.vbs
cscript dsa.vbs
del dsa.vbs

cls
echo download ok
@echo on


[ Last edited by electronixtar on 2006-6-4 at 11:01

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>"
Floor 3 Posted 2007-08-20 12:32 ·  中国 湖北 宜昌 电信
新手上路
Credits 5
Posts 3
Joined 2007-08-20 10:46
18-year member
UID 95393
Gender Male
Status Offline
Awesome guy! Bump, finally know about porn sites now @
Floor 4 Posted 2007-08-20 17:19 ·  中国 江西 吉安 电信
初级用户
Credits 41
Posts 20
Joined 2007-03-05 00:45
19-year member
UID 80788
Gender Male
Status Offline
Under WinXP SP2 it reports an error: tmp99.EXE - Application Error

Failed to initialize properly (0xc00000005)...
Floor 5 Posted 2007-10-30 15:24 ·  韩国 KT电信
初级用户
Credits 66
Posts 32
Joined 2007-10-23 09:54
18-year member
UID 100513
Gender Male
Status Offline
The PE file won't run!!!!!!!
Floor 6 Posted 2009-11-28 01:20 ·  中国 天津 电信
新手上路
Credits 8
Posts 33
Joined 2009-11-10 19:45
16-year member
UID 154524
Gender Male
Status Offline
Thanks for the hard work…
Floor 7 Posted 2009-11-28 12:46 ·  中国 湖南 娄底 电信
新手上路
Credits 7
Posts 7
Joined 2009-08-08 07:39
16-year member
UID 150044
Gender Male
Status Offline
I don't understand

Can someone explain
Floor 8 Posted 2009-11-29 14:22 ·  中国 广东 佛山 电信
新手上路
Credits 5
Posts 4
Joined 2009-11-27 19:35
16-year member
UID 155499
Gender Male
Status Offline
OP, thanks for the hard work, learning...
Forum Jump: