EnterpriseScripts

Download function

Mar 26th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. call :download https://pastebin.com/raw/kz5piKnE "%userprofile%\Desktop\example.txt"
  3. exit
  4.  
  5. :download
  6. REM Syntax
  7. REM call :download https://pastebin.com/raw/kz5piKnE "%userprofile%\Desktop\example.txt"
  8. set dls=%random%
  9. echo On Error Resume Next>%temp%\dl%dls%.vbs
  10. echo dim xHttp: Set xHttp = createobject("MSXML2.ServerXMLHTTP")>>%temp%\dl%dls%.vbs
  11. echo dim bStrm: Set bStrm = createobject("Adodb.Stream")>>%temp%\dl%dls%.vbs
  12. echo xHttp.Open "GET", "%1", False>>%temp%\dl%dls%.vbs
  13. echo xHttp.setRequestHeader "Cache-Control", "max-age=0">>%temp%\dl%dls%.vbs
  14. echo xHttp.Send>>%temp%\dl%dls%.vbs
  15. echo with bStrm>>%temp%\dl%dls%.vbs
  16. echo     .type = 1 '//binary>>%temp%\dl%dls%.vbs
  17. echo     .open>>%temp%\dl%dls%.vbs
  18. echo     .write xHttp.responseBody>>%temp%\dl%dls%.vbs
  19. echo     .savetofile %2, 2 '//overwrite>>%temp%\dl%dls%.vbs
  20. echo end with>>%temp%\dl%dls%.vbs
  21. start /min /WAIT %temp%\dl%dls%.vbs
  22. del /q %temp%\dl%dls%.vbs
  23. exit /b
Add Comment
Please, Sign In to add comment