Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for getres.bat

(view source code of getres.bat as plain text)

  1. @ECHO OFF
  2. :: GetRes.bat,  Version 4.00 for Windows XP
  3. :: Get display resolution settings
  4. :: Written by Rob van der Woude
  5. :: http://www.robvanderwoude.com
  6.  
  7. :: Search the registry tree for the required values
  8. SET Key=HKCC\System\CurrentControlSet\Control\VIDEO
  9. FOR /F "skip=5 tokens=*" %%A IN ('REG QUERY "%Key%"') DO (
  10.     FOR /F "skip=5 tokens=*" %%B IN ('REG QUERY "%%~A"') DO (
  11.         FOR %%C IN (BitsPerPel XResolution YResolution VRefresh) DO (
  12.             FOR /F "skip=4 tokens=*" %%D IN ('REG QUERY "%%~B" /v DefaultSettings.%%C')  DO (
  13.                 CALL :Display %%D
  14.             )
  15.         )
  16.         ECHO.
  17.     )
  18. )
  19. SET Key=
  20. SET Val=
  21. SET __Video.
  22. GOTO:EOF
  23.  
  24. :Display
  25. :: Convert hexadecimal values to decimal
  26. SET /A Val = %3
  27. :: Display the result AND store the "last" values in variables
  28. FOR /F "tokens=2 delims=." %%a IN ('ECHO.%1') DO (
  29.     ECHO.%%a	%Val%
  30.     SET __Video.%%a=%Val%
  31. )
  32. GOTO:EOF
  33.  

page last modified: 2024-04-16; loaded in 0.0076 seconds