The Computer Oracle

Is it possible to change display scaling via command line?

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Luau

--

Chapters
00:00 Is It Possible To Change Display Scaling Via Command Line?
00:49 Accepted Answer Score 10
01:50 Answer 2 Score 13
01:56 Thank you

--

Full question
https://superuser.com/questions/1334781/...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#windows10 #multiplemonitors #dpi #scaling

#avk47



ANSWER 1

Score 13


There's a command line app called SetDPI




ACCEPTED ANSWER

Score 10


Below is a batch script that will emulate the keyboard strokes to manipulate the GUI to adjust the Scale and layout options and Change the size or text, apps, and other items when it runs. This uses ms-settings:display to open the Display screen, and then it presses the tab key once and the up arrow 5 times using sendkeys to adjust the scale accordingly. It will press Alt+F4 at the end keys to close the screen once it completes. This method builds a dynamic vb script with a batch script and then executes the vb script with cscript to emulate pressing the keyboard keys.


Batch Script

Note: Just save this to a text file with a .bat or .cmd extension and execute it to run.

@ECHO OFF

explorer ms-settings:display
ping -n 2 127.0.0.1 > nul

:VBSDynamicBuild
SET TempVBSFile=%tmp%\~tmpSendKeysTemp.vbs
IF EXIST "%TempVBSFile%" DEL /F /Q "%TempVBSFile%"
ECHO Set WshShell = WScript.CreateObject("WScript.Shell") >>"%TempVBSFile%"
ECHO Wscript.Sleep 500                                    >>"%TempVBSFile%"
ECHO WshShell.SendKeys "{TAB}{UP 5}"                      >>"%TempVBSFile%"
ECHO Wscript.Sleep 500                                    >>"%TempVBSFile%"
ECHO WshShell.SendKeys "%%{F4}"                           >>"%TempVBSFile%"

CSCRIPT //nologo "%TempVBSFile%"
EXIT

Further Resources