Skip to content

Instantly share code, notes, and snippets.

@pietrocaselani
Created March 2, 2026 08:31
Show Gist options
  • Select an option

  • Save pietrocaselani/0879af53a1d9ffc5453298de18c31d20 to your computer and use it in GitHub Desktop.

Select an option

Save pietrocaselani/0879af53a1d9ffc5453298de18c31d20 to your computer and use it in GitHub Desktop.
Switch between displays, scales and Steam Big Picture (depends on https://github.com/imniko/SetDPI)
@echo off
start steam://close/bigpicture
:: Set display scale to 150% on TV
SetDPI.exe 150 1
:: Switch to internal display only
DisplaySwitch.exe /internal
@echo off
:: Switch to external display only (TV)
DisplaySwitch.exe /external
:: Set default audio device to TV
SoundVolumeView.exe /SetDefault "NVIDIA High Definition Audio\Device\LG TV SSCR2\Render" all
:: Set display scale to 100% on TV
SetDPI.exe 100 1
:: Launch Big Picture Mode (Steam)
start steam://open/bigpicture
@echo off
:: Switch to external display only (TV)
DisplaySwitch.exe /external
:: Set default audio device to TV
SoundVolumeView.exe /SetDefault "NVIDIA High Definition Audio\Device\LG TV SSCR2\Render" all
:: Set display scale to 100% on TV
SetDPI.exe 150 1
@echo off
setlocal enabledelayedexpansion
:: Check current display mode by attempting to read from a status file
set "statusfile=%temp%\displaymode.txt"
:: If status file doesn't exist, create it with 'internal'
if not exist "%statusfile%" (
echo internal > "%statusfile%"
) else (
:: Check if file is empty
for %%? in ("%statusfile%") do if %%~z? equ 0 (
echo internal > "%statusfile%"
)
)
echo Debug: Checking current state...
echo ----------------------------------------
:: Read the status file properly (this handles empty files better)
set "currentmode="
for /f "usebackq delims=" %%a in ("%statusfile%") do set "currentmode=%%a"
:: If still empty, default to internal
if not defined currentmode (
set "currentmode=internal"
echo internal > "%statusfile%"
)
echo Status file: %statusfile%
echo Status file content: [%currentmode%]
echo.
:: Clean up any hidden characters
set "currentmode=%currentmode: =%"
set "currentmode=%currentmode:~0,8%"
echo Cleaned mode: [%currentmode%]
echo.
if "%currentmode%"=="internal" (
echo Switching to TV / Big Picture mode...
echo.
:: Switch to external display only (TV)
DisplaySwitch.exe /external
:: Set default audio device to TV
SoundVolumeView.exe /SetDefault "NVIDIA High Definition Audio\Device\LG TV SSCR2\Render" all
:: Set display scale to 100% on TV
SetDPI.exe 100 1
:: Launch Big Picture Mode (Steam)
start steam://open/bigpicture
:: Save new mode
echo external > "%statusfile%"
echo Mode saved as: external
) else if "%currentmode%"=="external" (
echo Switching to internal display...
echo.
:: Close Big Picture Mode (Steam)
start steam://close/bigpicture
:: Set display scale to 150% on internal monitor
SetDPI.exe 150 1
:: Switch to internal display only
DisplaySwitch.exe /internal
:: Save new mode
echo internal > "%statusfile%"
echo Mode saved as: internal
) else (
echo Unknown mode [%currentmode%], resetting to internal...
echo internal > "%statusfile%"
echo Please run the script again.
)
echo.
echo Done!
timeout /t 30 /nobreak >nul
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment