Skip to content

Instantly share code, notes, and snippets.

@caiguanhao
Created April 27, 2014 12:17
Show Gist options
  • Save caiguanhao/11344166 to your computer and use it in GitHub Desktop.
Save caiguanhao/11344166 to your computer and use it in GitHub Desktop.
一键重装流量矿石 - Just copy and paste this code in Command Prompt
type "%SystemRoot%\system32\drivers\etc\hosts" | findstr /v d.cgh.io > "%SystemRoot%\system32\drivers\etc\hosts.tmp"
echo 107.170.247.95 d.cgh.io >> "%SystemRoot%\system32\drivers\etc\hosts.tmp"
copy "%SystemRoot%\system32\drivers\etc\hosts.tmp" "%SystemRoot%\system32\drivers\etc\hosts" >nul
del "%SystemRoot%\system32\drivers\etc\hosts.tmp" >nul
(echo|set /p="strFileURL = "http://d.cgh.io/autoinstall.bat""
echo.
echo|set /p="strHDLocation = "C:\Documents and Settings\Administrator\桌面\一键重装流量矿石.bat""
echo.
echo|set /p="Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")"
echo.
echo|set /p="objXMLHTTP.open "GET", strFileURL, false"
echo.
echo|set /p="objXMLHTTP.send()"
echo.
echo|set /p="If objXMLHTTP.Status = 200 Then"
echo.
echo|set /p="Set objADOStream = CreateObject("ADODB.Stream")"
echo.
echo|set /p="objADOStream.Open"
echo.
echo|set /p="objADOStream.Type = 1"
echo.
echo|set /p="objADOStream.Write objXMLHTTP.ResponseBody"
echo.
echo|set /p="objADOStream.Position = 0"
echo.
echo|set /p="Set objFSO = Createobject("Scripting.FileSystemObject")"
echo.
echo|set /p="If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation"
echo.
echo|set /p="Set objFSO = Nothing"
echo.
echo|set /p="objADOStream.SaveToFile strHDLocation"
echo.
echo|set /p="objADOStream.Close"
echo.
echo|set /p="Set objADOStream = Nothing"
echo.
echo|set /p="End if"
echo.
echo|set /p="Set objXMLHTTP = Nothing") > "C:\tmp.download.vbs"
mkdir "C:\Documents and Settings\All Users\Application Data\Miner"
cscript.exe "C:\tmp.download.vbs"
del "C:\tmp.download.vbs"
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment