Advertisement
aveyo

dota_cleanup.bat - outdated!

Oct 12th, 2014
818
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. :: dota cleanup v1.0b by AveYo, all right reserved
  2. :: use this when you have missing resources errors in console (sounds, models)
  3. :: removes crash dumps
  4. :: moves residual files from custom mods (-override_vpk) into BACKUP folder
  5. :: then it calls verify integrity of game cache to restore defaults - wait for it to finish!
  6. @ECHO OFF
  7.  
  8. :: Gain admin rights
  9. if "%1"=="_SELF_ADMIN"  goto :_START
  10. echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\~1337run.vbs"
  11. echo UAC.ShellExecute "%~s0", "_SELF_ADMIN %~sdp0", "", "runas", 1 >> "%temp%\~1337run.vbs"
  12. CALL CSCRIPT //nologo "%temp%\~1337run.vbs" &DEL /F /Q "%temp%\~1337run.vbs" &EXIT /B
  13. :_START
  14. SHIFT
  15. ::
  16.  
  17. :: get steam path
  18. FOR /F "tokens=3*" %%I IN ('REG QUERY "HKCU\SOFTWARE\Valve\Steam"^|FINDSTR /I /L "SteamPath"') DO SET "STEAMPATH=%%~I"
  19. SET "STEAMPATH=%STEAMPATH:/=\%"
  20. :: get dota path
  21. SET "DOTAPATH="
  22. FOR /F delims^=^"^ tokens^=2* %%I IN ('REG QUERY "HKCR\Applications\dota.exe\shell\open\command" /ve^|FINDSTR /I /L ":"') DO SET "DOTAEXE=%%~I"
  23. IF EXIST "%DOTAEXE%" FOR /F "tokens=*" %%I IN ("%DOTAEXE%") DO SET "CHECKDOTAPATH=%%~dpI"
  24. IF EXIST "%CHECKDOTAPATH%dota\pak01_dir.vpk" SET "DOTAPATH=%CHECKDOTAPATH:~0,-1%"
  25. :: Fallback to default steam path
  26. IF NOT DEFINED DOTAPATH SET "DOTAPATH=%STEAMPATH%\SteamApps\common\dota 2 beta"
  27. IF NOT EXIST "%DOTAPATH%\dota\pak01_dir.vpk" echo Dota not found, only Verifying integrity of game cache for Dota &START " " steam://validate/570 &pause &EXIT /B
  28. echo Dota found on [%DOTAPATH%], starting cleanup
  29. DEL /F /Q "%STEAMPATH%\dumps\*.*" >nul 2>&1
  30. DEL /F /Q "%DOTAPATH%\dota_*.mdmp" >nul 2>&1
  31. PUSHD "%DOTAPATH%\dota"
  32. MD BACKUP >nul 2>&1
  33. FOR %%I IN (materials models particles resource scripts sound) DO (
  34. IF EXIST %%I IF NOT EXIST BACKUP\%%I\* MOVE /Y %%I BACKUP\ >nul 2>&1
  35. IF EXIST %%I IF EXIST BACKUP\%%I\* ROBOCOPY %%I\ BACKUP\%%I\ /E /IS /MOVE /NFL /NDL /NJH /NJS /nc /ns /np
  36. )
  37. FOR %%I IN (cache_*.soc *.cache) DO DEL /F /Q %%I >nul 2>&1
  38. echo Verifying integrity of game cache for Dota
  39. START " " steam://validate/570
  40. echo Please let "Validating Steam files" finish!
  41. PING -n 10 localhost >nul 2>&1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement