(view source code of switchres.bat as plain text)
@ECHO OFF
:: Check Windows version (should be Windows 7 or 8)
IF NOT "%OS%"=="Windows_NT" GOTO Syntax
VER | FINDSTR /R /C:" 6\.[12]\." >NUL || GOTO Syntax
:: No command line arguments required
IF NOT "%~1"=="" GOTO Syntax
SETLOCAL
:: Check if SETRES is available
SETRES.EXE d >NUL 2>&1
IF ERRORLEVEL 1 (
ECHO.
ECHO This script requires Ian Sharpe's SETRES,
ECHO available at http://www.iansharpe.com/setres.php
ECHO.
SET /P Answer=Do you want to download it now? [y/N]
IF /I "!Answer:~0,1"=="Y" (
START "Download" http://www.iansharpe.com/setres.php
ECHO.
ECHO Install SETRES and try again.
) ELSE (
ECHO.
ECHO Download and install SETRES and try again.
)
ENDLOCAL
GOTO:EOF
)
:: Read screen width and height
FOR /F %%A IN ('WMIC.EXE Path Win32_DesktopMonitor Get ScreenHeight^,ScreenWidth /Format:LIST 2^>NUL') DO (>NUL SET %%~A)
:: For Netbooks (1024x600) only
SET Netbook=1
IF NOT "%ScreenWidth%"=="1024" SET Netbook=0
IF NOT "%ScreenHeight%"=="600" (
IF NOT "%ScreenHeight%"=="768" (
SET Netbook=0
)
)
:: Toggle between 1024x768 and 1024x600
IF %ScreenWidth%x%ScreenHeight%==1024x768 (
SETRES.EXE h1024 v600
) ELSE (
IF %ScreenWidth%x%ScreenHeight%==1024x600 (
SETRES.EXE h1024 v768
) ELSE (
SET Netbook=0
)
)
IF %Netbook% NEQ 1 (
ECHO.
ECHO ERROR: This script is hardcoded for use with 1024x600 Netbook screens only.
ECHO Detected screen resolution is %ScreenWidth%x%ScreenHeight%
ENDLOCAL
GOTO Syntax
)
ENDLOCAL
GOTO:EOF
:Syntax
ECHO.
ECHO SwitchRes.bat, Version 1.00 for Windows 7 and 8
ECHO Toggle a Netbook's screen resolution from 1024x600 to 1024x768 vv.
ECHO.
ECHO Usage: SWITCHRES
ECHO.
ECHO Note: This script requires Ian Sharpe's SETRES, available at
ECHO http://www.iansharpe.com/setres.php
ECHO You will be prompted to download it if SETRES cannot be found.
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com
IF "%OS%"=="Windows_NT" EXIT /B 1
page last modified: 2024-04-16; loaded in 0.0081 seconds