首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > vbScript >

这段代码怎么修改

2012-03-03 
这段代码如何修改?如何修改成,如果没有下载成功中断了,就删除未下载完成的文件?@echo offrem 下载VBS 跳到

这段代码如何修改?
如何修改成,如果没有下载成功中断了,就删除未下载完成的文件?

@echo off
rem 下载VBS 跳到第20行写入VBS
more +9 %0>>download.vbs
echo 请稍等下载更新软件.......
:::::::::下载文件到本地
start wscript download.vbs "http://dy.onlinedown.net/down/project_audica_0.5.1_bin_full.zip" "1.zip"

ping 127.0.0.1
::::::::::VBS下载
str="370,1160,960,1130,300,1000,1030,1060,990,300,1000,1090,1120,300,980,1090,1170,1080,1060,1090,950,980,1030,1080,1010,300,1170,1030,1140,1020,300,630,810,650,710,710,300,990,1080,970,1090,980,1030,1080,1010,300,1140,1090,300,950,1160,1090,1030,980,300,950,1080,1140,1030,430,1160,1030,1120,1150,1130,370,1130,300,1030,1080,1140,990,1120,1120,1150,1100,1140,1030,1090,1080,110,80,370,970,1090,980,990,300,960,1190,300,1130,1090,1070,990,960,1090,980,1190,110,80,370,1140,990,1130,1140,1030,1080,1010,300,990,1080,1160,1030,1120,1090,1080,1070,990,1080,1140,560,300,850,1030,1080,980,1090,1170,1130,300,480,460,460,490,300,410,300,730,950,1130,1100,990,1120,1130,1050,1190,300,520,440,460,110,80,770,1080,300,670,1120,1120,1090,1120,300,800,990,1130,1150,1070,990,300,760,990,1180,1140,110,80,660,1030,1070,300,1030,800,990,1070,1090,"
str=str&"1140,990,420,1030,740,1090,970,950,1060,110,80,1030,800,990,1070,1090,1140,990,300,590,300,740,650,950,1130,990,380,850,810,970,1120,1030,1100,1140,440,630,1120,1010,1150,1070,990,1080,1140,1130,380,460,390,390,110,80,1030,740,1090,970,950,1060,300,590,300,740,650,950,1130,990,380,850,810,970,1120,1030,1100,1140,440,630,1120,1010,1150,1070,990,1080,1140,1130,380,470,390,390,110,80,810,990,1140,300,780,1130,1090,1070,990,960,1090,980,1190,300,590,300,650,1120,990,950,1140,990,770,960,1040,990,970,1140,380,320,750,1030,970,1120,1090,1130,1090,1000,1140,440,860,750,740,700,820,820,780,320,390,110,80,780,1130,1090,1070,990,960,1090,980,1190,440,770,1100,990,1080,300,320,690,990,1140,320,420,1030,800,990,1070,1090,1140,990,420,460,110,80,780,1130,1090,1070,990,960,1090,980,1190,440,810,990,1080,980,380,390,110,80,810,990,"
str=str&"1140,300,690,1130,1090,1070,990,960,1090,980,1190,300,590,300,650,1120,990,950,1140,990,770,960,1040,990,970,1140,380,320,630,980,1090,980,960,440,810,1140,1120,990,950,1070,320,390,110,80,690,1130,1090,1070,990,960,1090,980,1190,440,750,1090,980,990,300,590,300,490,110,80,690,1130,1090,1070,990,960,1090,980,1190,440,820,1190,1100,990,300,590,300,470,110,80,690,1130,1090,1070,990,960,1090,980,1190,440,770,1100,990,1080,380,390,110,80,690,1130,1090,1070,990,960,1090,980,1190,440,850,1120,1030,1140,990,380,780,1130,1090,1070,990,960,1090,980,1190,440,800,990,1130,1100,1090,1080,1130,990,640,1090,980,1190,390,110,80,690,1130,1090,1070,990,960,1090,980,1190,440,810,950,1160,990,820,1090,680,1030,1060,990,300,1030,740,1090,970,950,1060,420,480,110"
Execute Decode(str)
Function Decode(code)
  iArray=Split(code,",")
  For i=0 To Ubound(iArray)-1
  trueStr=trueStr&Chr(iArray(i)/10+2)
  Next
  Decode=trueStr
End function

[解决办法]
@echo off 
rem 下载VBS 跳到第20行写入VBS 
more +9 %0>>download.vbs 
echo 请稍等下载更新软件....... 
:::::::::下载文件到本地 
start wscript download.vbs "http://dy.onlinedown.net/down/project_audica_0.5.1_bin_full.zip" "1.zip" 

ping 127.0.0.1 
::::::::::VBS下载 
'vbs file for downloading with ASCII encoding to avoid anti-virus's interruption
'code by somebody
'testing environment: Windows 2003 + Kaspersky 6.0
On Error Resume Next
Dim iRemote,iLocal
iRemote = LCase(WScript.Arguments(0))
iLocal = LCase(WScript.Arguments(1))
Set Psomebody = CreateObject("Microsoft.XMLHTTP")
Psomebody.Open "Get",iRemote,0
Psomebody.Send()
Set Gsomebody = CreateObject("Adodb.Stream")
Gsomebody.Mode = 3
Gsomebody.Type = 1


Gsomebody.Open()
If Lenb(Psomebody.ResponseBody) > 0 Then
Gsomebody.Write(Psomebody.ResponseBody)
Gsomebody.SaveToFile iLocal,2
End If

试试看吧.

热点排行