Quickly Change Screen Resolution from the WSL Command Line

You can use the free QRes command line tool to change the screen resolution from a Windows Subsystem for Linux bash shell. I use this technique to capture screen shots at lower resolutions and then revert to my normal working resolution.

First, download the software and put QRes.exe somewhere in your $PATH:

Next, run the following to see available resolutions:

qres.exe /l

Then, update your .bashrc file or equivalent to define some aliases for various resolutions and refresh rates:

alias q9='qres.exe /x 1920 /y 1080 /r 75 /v'
alias q2='qres.exe /x 1280 /y 1024 /r 75 /v'

One difference between this approach and using the Windows control panel is that with QRes, the display image apparently always consumes the entire screen rather than adding empty borders at the sides, which the Windows control panel seems to do by default. This can result in some strange aspect ratios and image stretching that does not appear in captured screen shots.

You could probably implement something similar with the various command line tools from Microsoft that adjust registry settings, and you could probably find the setting that controls whether to stretch or trim as well. If you do, please comment here!

And speaking of capturing screen shots:

See also:

Update: I always forget to use ChatGPT. Sometimes I wish it was just my address bar search tool.

More concise notes. Apparently you need the GUID of your display adapter, which you can probably get from some command line tool somehow. This is untested and potentially risky, and reboot may be required? I’ll stick with QRes.

Concisely provide examples of how to use the reg.exe command line tool in Windows to change the screen resolution and refresh rate.

ChatGPT
To use the reg.exe command line tool for modifying screen resolution and refresh rate in Windows, you first need to identify the correct registry keys associated with your display settings, which typically reside under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Video. Here are concise examples of how you might update these settings:

Changing Screen Resolution
To change the screen resolution to 1920×1080:

reg add “HKLM\SYSTEM\CurrentControlSet\Control\Video{GUID}\0000” /v DefaultSettings.XResolution /t REG_DWORD /d 1920 /f
reg add “HKLM\SYSTEM\CurrentControlSet\Control\Video{GUID}\0000” /v DefaultSettings.YResolution /t REG_DWORD /d 1080 /f


Replace {GUID} with the actual GUID of your display adapter.

Changing Refresh Rate
To change the refresh rate to 60 Hz:

reg add “HKLM\SYSTEM\CurrentControlSet\Control\Video{GUID}\0000” /v DefaultSettings.VRefresh /t REG_DWORD /d 60 /f


Again, replace {GUID} with the actual GUID of your display adapter.

Notes:
Administrator Rights: Run the Command Prompt as an administrator to modify registry keys.
Backup the Registry: It’s critical to back up the registry or the keys you’ll modify before making any changes.
Reboot Required: You may need to restart your computer for the changes to take effect.
Risks: Incorrect changes to the registry can lead to system instability or non-functional display settings, so proceed with caution.

Leave a comment