Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :: dota2bandwidthsaver by aveyo v1.0 - run as administrator! undo script @ pastebin.com/TAfRprCd
- @ECHO OFF &SETLOCAL ENABLEDELAYEDEXPANSION
- :: CHOOSE HOW MUCH TO BLOCK HERE
- SET "domains=www.dota2.com cdn.dota2.com media.steampowered.com images.akamai.steamusercontent.com"
- :: www.dota2.com = blog and shop stuff
- :: cdn.akamai.steamstatic.com = steam avatars etc.
- :: cdn.dota2.com media.steampowered.com = shop stuff, localized stuff, steam profile stuff etc.
- :: images.akamai.steamusercontent.com = custom games preview images, steam profile stuff
- ECHO. &ECHO PLEASE WAIT...
- :: kill dota2 & steam
- TASKKILL /F /IM dota2.exe >nul 2>&1
- TASKKILL /F /IM steam.exe >nul 2>&1
- CALL :DETECT_STEAM_PATH
- :: clear cache
- IF DEFINED STEAMPATH RD /S /Q "%STEAMPATH%\appcache\httpcache" >nul 2>&1
- RD /S /Q "%USERPROFILE%\AppData\Local\Steam" >nul 2>&1
- :: blacklist cdn
- CALL :BLACK_LIST
- :: end
- ENDLOCAL
- EXIT /B
- :DETECT_STEAM_PATH
- :: search in filetypes/default_path/registry and save it in %STEAMPATH% var
- FOR /F USEBACKQ^ TOKENS^=2^ DELIMS^=^" %%A IN (`FTYPE steam 2^>nul`) DO SET "STEAMPATH=%%~dpA"
- IF EXIST "%STEAMPATH%\Steam.exe" GOTO :eof
- SET "STEAMPATH=C:\Program Files (x86)\Steam\"
- IF EXIST "%STEAMPATH%\Steam.exe" GOTO :eof
- :: Valve why do you use Linux paths under Windows?!
- FOR /F "tokens=2* delims=_" %%A IN (`REG QUERY "HKCU\SOFTWARE\Valve\Steam" 2^>nul ^| FIND /I "SteamPath"`) DO SET "STEAMPATH=%%~A"
- SET "STEAMPATH=%STEAMPATH:~6%"
- SET "STEAMPATH=%STEAMPATH:/=\%"
- SET "STEAMPATH=%STEAMPATH:\\=\%"
- IF EXIST "%STEAMPATH%\Steam.exe" GOTO :eof
- SET "STEAMPATH="
- GOTO :eof
- ::END.DETECT_STEAM_PATH
- :BLACK_LIST
- SET "h=%WINDIR%\System32\drivers\etc\hosts"
- IF NOT EXIST "%h%" EXIT /B
- :: stop if already added
- FINDSTR "%domains%" "%h%" >nul 2>&1
- IF "%ERRORLEVEL%"=="0" EXIT /B
- :: get rights and add entries
- TAKEOWN /F "%h%" >nul 2>&1
- ICACLS "%h%" /reset /T /Q >nul 2>&1
- ATTRIB -R "%h%" >nul 2>&1
- COPY /Y "%h%" "%h%.d2bws"
- (ECHO. &ECHO # dota2bandwidthsaver) >> "%h%"
- FOR %%A IN (%domains%) DO ECHO 0.0.0.0 %%A >> "%h%"
- ATTRIB +R "%h%" >nul 2>&1
- :: reset network stack
- NBTSTAT -R >nul 2>&1
- IPCONFIG /flushdns >nul 2>&1
- NET STOP dnscache >nul 2>&1
- NET START dnscache >nul 2>&1
- GOTO :eof
- ::END.BLACK_LIST
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement