SHARE
TWEET

steam_fix

aveyo Apr 21st, 2017 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* 2>nul&goto init %~nx0
  2. :start [ Batch main ]
  3. echo.
  4. echo   -------------------------------------------------------------
  5. echo  ^|                    AVEYO`S STEAM FIX                        ^|
  6. echo  ^|-------------------------------------------------------------^|
  7. echo  ^|  Warning! This will forcefully close Steam Games            ^|
  8. echo  ^|  Press Alt+F4 to cancel                                     ^|
  9. echo   -------------------------------------------------------------
  10. echo.
  11. call :wait 10 Starting
  12. call :set_dota
  13. taskkill /t /f /im steam.exe >nul 2>&1
  14. echo  Please wait while repairing Steam file permissions
  15. for %%a in (workshop downloading temp) do (
  16. takeown /f "%steamapps%\%%a" /r /d y >nul 2>&1
  17. icacls "%steamapps%\%%a" /reset /t /q >nul 2>&1
  18. attrib -r "%steamapps%\%%a" /s /d >nul 2>&1
  19. )
  20. echo  Please wait while repairing Steam Service
  21. start "w" /MIN /WAIT "%steampath%\bin\SteamService.exe" /repair
  22. echo  Please wait while starting Steam with admin rights
  23. start "w" "%steampath%\Steam.exe" -silent -console -forceservice
  24. :: done!
  25. call :end DONE!
  26. goto :eof
  27.  
  28. :set_dota [ Batch shared functions ]
  29. rem set "steamapps=D:\STEAM LIBRARY\steamapps" & rem uncomment and adjust this line to override steamapps detection
  30. rem set "dota=D:\STEAM LIBRARY\steamapps\common\dota 2 beta\game" & rem uncomment and adjust this line to override dota detection
  31. set "steampath=c:\Program Files (x86)\Steam"
  32. rem goto :eof & rem uncomment to override steampath detection
  33. if not exist "%steampath%" call :get_reg "HKCU\SOFTWARE\Valve\Steam" "SteamPath" steampath
  34. if not exist "%steampath%" call :end # Cannot find SteamPath in registry HKCU\SOFTWARE\Valve\Steam!
  35. for %%s in ("%steampath%") do set "steampath=%%~dpns" & set "libfilter=LibraryFolders { TimeNextStatsReport ContentStatsID }"
  36. if not exist "%steampath%\SteamApps\libraryfolders.vdf" call :end # Cannot find Steam cfg %steampath%\SteamApps\libraryfolders.vdf!
  37. for /f usebackq^ delims^=^"^ tokens^=4 %%s in (`findstr /v "%libfilter%" "%steampath%\SteamApps\libraryfolders.vdf"`) do (
  38. if exist "%%s\steamapps\appmanifest_570.acf" if exist "%%s\steamapps\common\dota 2 beta\game\dota\maps\dota.vpk" set "libfs=%%s")
  39. set "steamapps=%steampath%\steamapps"
  40. if defined libfs set "steamapps=%libfs:\\=\%\steamapps"
  41. if not exist "%steamapps%\common\dota 2 beta\game\dota\maps\dota.vpk" call :end # Cannot find DOTA - %steamapps%\common\dota 2 beta!
  42. set "dota=%steamapps%\common\dota 2 beta\game" & goto :eof
  43. :get_reg Params: 1=KeyName 2=ValueName 3=TargetVariable
  44. for /f "usebackq delims=? eol=*" %%s in (`reg query "%~1" /v "%~2"`) do set "_r_=%%s" & call set "_r_=%%_r_:    =?%%"
  45. for /f "delims=? tokens=3* eol=*" %%s in ("%_r_%") do call set "%~3=%%s" & set "_r_=" & goto :eof
  46. :wait Params: 1=Seconds 2=Message
  47. setlocal enabledelayedexpansion &if not defined x1337cr for /f %%a in ('copy /z "%~dpf0" nul') do set "x1337cr=%%a"
  48. (for /l %%i in (%1,-1,1) do <NUL SET /P "=_%2 in %%i !x1337cr!" &ping -n 2 localhost >nul 2>&1) & endlocal & goto :eof
  49. :end Params: 1=Message - start with # to signal error
  50. (if "%1"=="#" COLOR 7c) &echo. &echo  %* &(call :wait 9 Closing) &echo/             &(if "%1"=="#" exit) &endlocal &color &goto :eof
  51. :::eof:::
  52.  
  53. :init [ Batch main functions ]
  54. @echo off & setlocal disabledelayedexpansion &title AveYo's %~nx0 &color 0B &cls & if "%1"=="_SELF_ADMIN" shift &shift & goto :start
  55. reg query "HKEY_USERS\S-1-5-20\Environment" /v temp 1>nul 2>nul && goto :start || echo Requesting admin rights.. & color 7c
  56. call cscript /nologo /e:JScript "%~f0" get_rights "%1" & exit & goto :eof
  57.  
  58. *//* [ JScript functions ] all lines above are ignored by starting script with a js comment */
  59. function get_rights(fn) {WSH.CreateObject("Shell.Application").ShellExecute(fn,"_SELF_ADMIN "+fn+" "+WSH.Arguments(1),"","runas",1)}
  60. if (WSH.Arguments.length>=1) {if (WSH.Arguments(0)=="get_rights") get_rights(WSH.ScriptFullName)}
  61. //
RAW Paste Data
Top