Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @goto=init %~nx0
- :: Batch designed for Windows 10 - compatible with Windows 7
- ::----------------------------------------------------------------------------------------------------------------------------------
- :about %1:[0c = red-on-black: Batch was run as user, 0b = cyan-on-black Batch was run as admin]
- ::----------------------------------------------------------------------------------------------------------------------------------
- call :clearline 1
- call :color %1. " --------------------------------------------------------------------- "
- call :color %1. " : UNDO_WINDOWS_GAMING_STEAM_DOTA_FIX V9.5 : "
- call :color %1. " :---------------------------------------------------------------------: "
- call :color %1. " : -GameDVR -Xbox -GameBarPresenceWriter -FullscreenOpt AppCompatFlags : "
- call :color %1. " : : "
- call :color %1. " : Press Alt+F4 to cancel Always run latest version : "
- call :color %1. " --------------------------------------------------------------------- "
- call :color %1. " "
- exit/b
- ::----------------------------------------------------------------------------------------------------------------------------------
- :main [ Batch main function ]
- ::----------------------------------------------------------------------------------------------------------------------------------
- title AveYo's UNDO WINDOWS GAMING + STEAM DOTA FIX
- color 07
- call :about 0b
- ::timeout /t 10
- call :reg_query "HKCU\Environment" "Fix choices" CHOICES
- if defined CHOICES echo Last choices: %CHOICES%
- ::----------------------------------------------------------------------------------------------------------------------------------
- call :mcolor 07 " Reset " 70 " AMD DVR / Nvidia GFE / ShadowPlay " 07. " blocking.. "
- :: amd dvr task restore
- set "tasks=%SystemRoot%\System32\Tasks"
- if exist "%tasks%\StartDVR.bak" (
- pushd "%tasks%"
- icacls StartDVR /grant "Everyone:(OI)(CI)W"
- rd /s /q StartDVR
- copy /y StartDVR.bak StartDVR
- popd
- ) >nul 2>nul
- set "regkey=HKCU\SOFTWARE\AMD\CN"
- reg delete "%regkey%" /v "OverclockEnabled" /f >nul 2>nul
- reg delete "%regkey%\ANALYTICS" /v "AnalyticsUploadDays" /f >nul 2>nul
- set "regkey=HKCU\Software\ATI\ACE\Settings\Runtime"
- reg delete "%regkey%\Graphics\OverDrive5" /v "OverclockEnabled_DEF" /f >nul 2>nul
- :: amd dvr / relive / telemetry executable restore
- call :UnBlockExecution "amddvr amdow"
- :: nvidia gfe / shadowplay / telemetry executable restore
- call :UnBlockExecution "nvstreamer NvTelemetryContainer NvContainer" &rem nvnodejslauncher NVNetworkService
- call :mcolor 07 " Reset " 70 " Game DVR " 07. " to defaults.. "
- (
- reg add "HKCU\Software\Microsoft\GameBar" /v "AllowAutoGameMode" /t REG_DWORD /d "1" /f
- reg add "HKCU\Software\Microsoft\GameBar" /v "ShowStartupPanel" /t REG_DWORD /d "1" /f
- reg add "HKCU\Software\Microsoft\GameBar" /v "UseNexusForGameBarEnabled" /t REG_DWORD /d "1" /f
- reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\GameDVR" /v "AppCaptureEnabled" /t REG_DWORD /d "1" /f
- reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\GameDVR" /v "AudioCaptureEnabled" /t REG_DWORD /d "1" /f
- reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\GameDVR" /v "CursorCaptureEnabled" /t REG_DWORD /d "1" /f
- reg add "HKCU\System\GameConfigStore" /v "GameDVR_Enabled" /t REG_DWORD /d "1" /f
- reg add "HKLM\Software\Policies\Microsoft\Windows\GameDVR" /v "AllowgameDVR" /t REG_DWORD /d "1" /f
- ) >nul 2>nul
- call :UnBlockExecution "bcastdvr GamePanel"
- :: - GameBar - alternative disable method
- set "regkey=Microsoft\WindowsRuntime\ActivatableClassId\Windows.Media.Capture.Internal.AppCaptureShell"
- reg add "HKLM\SOFTWARE\%regkey%" /v "ActivationType" /t REG_DWORD /d 1 /f >nul 2>nul
- reg add "HKLM\SOFTWARE\WOW6432Node\%regkey%" /v "ActivationType" /t REG_DWORD /d 1 /f >nul 2>nul
- ::----------------------------------------------------------------------------------------------------------------------------------
- call :mcolor 07 " Reset " 70 " Xbox " 07. " to defaults.. "
- (
- reg add "HKLM\System\CurrentControlSet\Services\xbgm" /v "Start" /t REG_DWORD /d "3" /f
- schtasks /Change /TN "Microsoft\XblGameSave\XblGameSaveTask" /ENABLE
- schtasks /Change /TN "Microsoft\XblGameSave\XblGameSaveTaskLogon" /ENABLE
- sc config XblAuthManager start= auto
- sc config XblGameSave start= auto
- sc config XboxGipSvc start= auto
- sc config XboxNetApiSvc start= auto
- ) >nul 2>nul
- ::----------------------------------------------------------------------------------------------------------------------------------
- call :mcolor 07 " Reset " 70 " GameBarPresenceWriter " 07. " to defaults.. "
- set "regkey=Microsoft\WindowsRuntime\ActivatableClassId\Windows.Gaming.GameBar.PresenceServer.Internal.PresenceWriter"
- reg add "HKLM\SOFTWARE\%regkey%" /v "ActivationType" /t REG_DWORD /d 1 /f /reg:64 >nul 2>nul
- reg add "HKLM\SOFTWARE\%regkey%" /v "ActivationType" /t REG_DWORD /d 1 /f /reg:32 >nul 2>nul
- call :UnBlockExecution "GameBarPresenceWriter"
- ::----------------------------------------------------------------------------------------------------------------------------------
- call :mcolor 07 " Reset " 70 " Fullscreen so-called optimizations " 07. " to defaults.. "
- set "regkey=Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"
- for %%a in (HKCU HKLM) do for %%B in (32 64) do reg delete "%%a\%regkey%" /va /f /reg:%%B >nul 2>nul
- ::----------------------------------------------------------------------------------------------------------------------------------
- call :mcolor 07 " Reset " 70 " AppCompatFlags " 07. " to defaults.. "
- set "regkey=Software\Policies\Microsoft\Windows\AppCompat"
- for %%a in (HKCU HKLM) do (
- reg delete "%%a\%regkey%" /v "DisablePCA" /f
- reg delete "%%a\%regkey%" /v "DisableUAR" /f
- reg delete "%%a\%regkey%" /v "AITEnable" /f
- ) >nul 2>nul
- :: reset tdr limits
- set "regkey=HKLM\SYSTEM\CurrentControlSet\Control\GraphicsDrivers"
- (
- reg add "%regkey%" /v TdrLevel /t REG_DWORD /d 0x3 /f
- reg add "%regkey%" /v TdrDelay /t REG_DWORD /d 0x2 /f
- reg add "%regkey%" /v TdrDdiDelay /t REG_DWORD /d 0x5 /f
- reg add "%regkey%" /v TdrLimitCount /t REG_DWORD /d 0x5 /f
- reg add "%regkey%" /v TdrLimitTime /t REG_DWORD /d 0x3c /f
- ) >nul 2>nul
- :: Generic windows gaming fixes end here, Steam and Dota fixes below
- ::----------------------------------------------------------------------------------------------------------------------------------
- call :set_steam
- call :set_dota
- :: reset steam and dota fullscreen so-called optimization and dpi scaling..
- set "regkey=Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"
- for %%# in ("%STEAMPATH%\Steam.exe" "%DOTA%\bin\win64\dota2.exe" "%DOTA%\bin\win32\dota2.exe") do (
- for %%a in (HKCU HKLM) do for %%B in (32 64) do reg delete "%%a\%regkey%" /v "%%~#" /f /reg:%%B
- ) >nul 2>nul
- :: reset steam and dota image file execution
- set "exes=Steam.exe steamwebhelper.exe GameOverlayUI.exe dota2.exe"
- set "regkey=HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options"
- for %%a in (%exes%) do for %%B in (32 64) do reg delete "%regkey%\%%a" /va /f /reg:%%B >nul 2>nul
- :: remove Steam_tweak lnk
- del /f /q "%USERPROFILE%\Desktop\Steam_tweak.lnk" 2>nul
- :done
- ::----------------------------------------------------------------------------------------------------------------------------------
- call :mcolor b0 " DONE " 0b " Some changes will take effect after the next PC restart "
- timeout /t 12 >nul
- exit
- ::----------------------------------------------------------------------------------------------------------------------------------
- :: Utility functions
- ::----------------------------------------------------------------------------------------------------------------------------------
- :UnBlockExecution %1:[executable names without extension, like "bcastdvr GamePanel" ]
- set "regkey=HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options"
- for %%a in (%~1) do for %%B in (32 64) do (
- reg delete "%regkey%\%%a.exe" /v Debugger /f /reg:%%B
- ) >nul 2>nul
- exit/b
- :set_steam [OUTPUTS] STEAMPATH STEAMDATA STEAMID AveYo : Override detection below if needed
- set "STEAMPATH=D:\Steam"
- if not exist "%STEAMPATH%\Steam.exe" call :reg_query STEAMPATH "HKCU\SOFTWARE\Valve\Steam" "SteamPath"
- set "STEAMDATA=" & if defined STEAMPATH for %%. in ("%STEAMPATH%") do set "STEAMPATH=%%~dpnx."
- if not exist "%STEAMPATH%\Steam.exe" call :end # Cannot find SteamPath in registry
- call :reg_query ACTIVEUSER "HKCU\SOFTWARE\Valve\Steam\ActiveProcess" "ActiveUser" & set/a "STEAMID=ACTIVEUSER" >nul 2>nul
- if exist "%STEAMPATH%\userdata\%STEAMID%\config\localconfig.vdf" set "STEAMDATA=%STEAMPATH%\userdata\%STEAMID%"
- if not defined STEAMDATA for /f "delims=" %%. in ('dir "%STEAMPATH%\userdata" /b/o:d/t:w/s 2^>nul') do set "ACTIVEUSER=%%~dp."
- if not defined STEAMDATA for /f "delims=\" %%. in ("%ACTIVEUSER:*\userdata\=%") do set "STEAMID=%%."
- if exist "%STEAMPATH%\userdata\%STEAMID%\config\localconfig.vdf" set "STEAMDATA=%STEAMPATH%\userdata\%STEAMID%"
- exit/b
- :set_dota [OUTPUTS] STEAMAPPS DOTA CONTENT AveYo : Override detection below if needed
- set "DOTA=D:\Games\steamapps\common\dota 2 beta\game"
- if exist "%DOTA%\dota\maps\dota.vpk" set "STEAMAPPS=%DOTA:\common\dota 2 beta=%" & exit/b
- set "libfilter=LibraryFolders { TimeNextStatsReport ContentStatsID }"
- if not exist "%STEAMPATH%\SteamApps\libraryfolders.vdf" call :end # Cannot find "%STEAMPATH%\SteamApps\libraryfolders.vdf"
- for /f usebackq^ delims^=^"^ tokens^=4 %%s in (`findstr /v "%libfilter%" "%STEAMPATH%\SteamApps\libraryfolders.vdf"`) do (
- if exist "%%s\steamapps\appmanifest_570.acf" if exist "%%s\steamapps\common\dota 2 beta\game\dota\pak01_*.vpk" set "libfs=%%s")
- set "STEAMAPPS=%STEAMPATH%\steamapps" & if defined libfs set "STEAMAPPS=%libfs:\\=\%\steamapps"
- if not exist "%STEAMAPPS%\common\dota 2 beta\game\dota\maps\dota.vpk" call :end # Missing "%STEAMAPPS%\common\dota 2 beta\game"
- set "DOTA=%STEAMAPPS%\common\dota 2 beta\game" & set "CONTENT=%STEAMAPPS%\common\dota 2 beta\content"
- exit/b
- :reg_query [USAGE] call :reg_query ResultVar "HKCU\KeyName" "ValueName"
- (for /f "skip=2 delims=" %%s in ('reg query "%~2" /v "%~3" /z 2^>nul') do set ".=%%s" & call set "%~1=%%.:*) =%%") & exit/b
- ::----------------------------------------------------------------------------------------------------------------------------------
- :: Core functions
- ::----------------------------------------------------------------------------------------------------------------------------------
- :set_macros [OUTPUTS] %[BS]%=BackSpace %[CR]%=CarriageReturn %[GL]%=Glue/NonBreakingSpace %[DEL]%=DelChar %[DEL7]%=DelCharX7
- pushd "%TEMP%" & echo=WSH.Echo(String.fromCharCode(160))>` & for /f %%# in ('cscript //E:JScript //nologo `') do set "[GL]=%%#"
- for /f %%# in ('echo prompt $H ^| cmd') do set "[BS]=%%#" & for /f %%# in ('copy /z "%~dpf0" nul') do set "[CR]=%%#"
- for /f "tokens=2 delims=1234567890" %%# in ('shutdown /?^|findstr /bc:"E"') do set "[TAB]=%%#"
- set/p "=-"<nul>` &set "ECHOP=<nul set/p =%[BS]%" &set "[DEL]=%[BS]%%[GL]%%[BS]%" &call set "[DEL3]=%%[DEL]%%%%[DEL]%%%%[DEL]%%"
- set "[L]=-%[DEL]%\..\%[DEL3]%"&set "[J]=-%[DEL]%/..\%[DEL3]%"&set "[DEL6]=%[DEL3]%%[DEL3]%" &set "LABEL=echo. &call :color 70. "
- set "INFO=call :color b0 " INFO " &echo" & set "WARN=call :color e0 " WARN " &echo" & set "ERROR=call :color cf " ERROR " &echo"
- exit/b &REM AveYo - :clearline and :color depend on this, initialize with call :set_macros
- :clearline Number[how many lines above to delete - macro designed for Windows 10 but adjusted to work under 7 too]
- ( if not defined [DEL] call :set_macros ) &setlocal enableDelayedExpansion & set "[LINE]=%[CR]%" & set "[LINE7]=" & set "[COL]="
- for /f "skip=4 tokens=2 delims=:" %%a in ('mode con') do for %%c in (%%a) do if not defined [COL] call set "[COL]=%%c"
- set/a "[C7]=2+(%[COL]%+7)/8"&for /l %%i in (1,1,%[COL]%) do call set "[CLR]=%%[CLR]%%%[GL]%"&call set "[LINE]=%[DEL]%%%[LINE]%%"
- for /L %%a in (1,1,%[C7]%) do call set "[LINE7]=%%[LINE7]%%%[BS]%"
- ver | find "10." >nul & if errorlevel 1 (for /L %%i in (1,1,%1) do echo;%[TAB]%%[LINE7]%%[CLR]% & echo;%[TAB]%%[LINE7]% ) else (
- for /l %%i in (1,1,%1) do <nul set/p "=![LINE]!" )
- endlocal & exit/b &REM Usage: call :clearline 2
- :color BgFg.[one or both of hexpair can be _ as defcolor, optional . use newline] text["text with spaces"]
- setlocal enableDelayedExpansion &set "bf=%~1"&set "tx=%~2"&set "tx=-%[BS]%!tx:\=%[L]%!"&set "tx=!tx:/=%[J]%!"&set "tx=!tx:"=\"!"
- set "bf=!bf: =!" &set "bc=!bf:~0,1!" &set "fc=!bf:~1,1!" &set "nl=!bf:~2,1!"&set "bc=!bc:_=%BackClr%!"&set "fc=!fc:_=%TextClr%!"
- pushd "%TEMP%" & findstr /p /r /a:!bc!!fc! "^^-" "!tx!\..\`" nul &<nul set/p "=%[DEL]%%[DEL6]%" &popd &if defined nl echo/%[GL]%
- endlocal & exit/b &REM AveYo - Usage: call :color fc Hello & call :color _c " fancy " & call :color cf. World
- :mcolor BgFg. "only-quoted-text1" BgFg. "only-quoted-text2" etc.
- set "-mc~=" & for %%C in (%*) do if "%%C"=="%%~C" (call set "-mc~=%%-mc~%% & call :color %%C") else call set "-mc~=%%-mc~%% %%C"
- echo. %-mc~% & exit/b &REM AveYo - Usage: call :mcolor fc "Hello" _c " fancy " cf. "World"
- :end %1:Message[Delayed termination with status message - prefix with # to signal failure]
- echo. & if "%~1"=="#" ( %ERROR% %* & timeout /t 32 & exit ) else %INFO% %* & timeout /t 20 & exit
- ::----------------------------------------------------------------------------------------------------------------------------------
- :init Console preferences sets color table and prevents mouseclicks pausing the script
- ::----------------------------------------------------------------------------------------------------------------------------------
- @echo off & setlocal &set "BackClr=0" &set "TextClr=7" &set "Columns=40" &set "Lines=120" &set "Buff=9999" &call :set_macros 2>nul
- rem reg delete "HKCU\Console\init" /va /f >nul 2>nul
- rem if not "%1"=="init" ( cd/d %~dp0 & start "init" "%~f0" init & exit/b ) else goto :main &rem " Simple no admin self-restart "
- if "%1"=="init" shift &shift & goto :main &rem " Admin self-restart flag found, jump to :main "
- reg query "HKEY_USERS\S-1-5-20\Environment" /v temp 1>nul 2>nul && goto :main || call :about 0c & echo Requesting admin rights..
- powershell -noprofile -c "Start-Process cmd.exe -ArgumentList '/c \"%~f0\" init' -verb RunAs"
- exit
- ::
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement