@echo on
@setlocal EnableDelayedExpansions
rem
rem script that helps the crash issue with my NVIDIA driver upgrade and 9650M GT card.
rem
rem W. Wood
rem
@set suffix=video.reg
@set file=%tmp%\%random%_%suffix%
@set file1=%tmp%\%random%_%suffix%
if EXIST %file% @del %file%
if EXIST %file1% @del %file1%
rem export registry keys
regedit /e %file% HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Video > nul
rem find the keys that we're looking for
for /f "tokens=1 delims=" %%A in ('find "\0000]" %file%') do call :buildkeys %%A
if EXIST %file% del %file% > nul
goto EOF
:buildkeys
SET passed=%~1%
SET passed=%passed:~1,-1%
if not "%passed:~0,4%"=="HKEY" goto EOF
rem
rem determine if it's an NVIDIA
rem
@set suffix=video.reg
@set file1=%tmp%\%random%_%suffix%
regedit /e %file1% %passed% > nul
find "NVIDIA" %file1% > nul
SET found=%ERRORLEVEL%
if EXIST %file1% del %file% > nul
if "%found%" NEQ "0" goto EOF
rem
rem NVIDIA has been found.
rem
echo Windows Registry Editor Version 5.00 > %file1%
echo. >> %file1%
echo [%passed%] >> %file1%
echo "PerfLevelSrc"=dword:00002222 >> %file1%
echo "PowerMizerDefault"=dword:00000001 >> %file1%
echo "PowerMizerEnable"=dword:00000000 >> %file1%
echo "PowerMizerLevel"=dword:00000001 >> %file1%
echo "PowerMizerLevelAC"=dword:00000001 >> %file1%
regedit /S %file1%
del %file1% > nul
goto EOF
:EOF