Change your screen resolution from the command line

ChangeScreenResolution.exe allows you to the following things from your Windows command line:

ChangeScreenResolution.exe Screenshot

Quick examples

Change screen resolution of all monitors to 800x600px
ChangeScreenResolution.exe /w=800 /h=600

Change screen resolution of monitors with index 0 to 800x600px
ChangeScreenResolution.exe /w=800 /h=600 /d=0

Change screen resolution of all monitors to 800x600px with refresh rate of 60Hz and 32bit color depth
ChangeScreenResolution.exe /w=800 /h=600 /f=60 /b=32

Set color depth of display with index 1 to 16bit
ChangeScreenResolution.exe /b=16 /d=1

List all available modes of displays with index 1,3,5
ChangeScreenResolution.exe /m /d=1,3,5

List all available displays
ChangeScreenResolution.exe /l

Download

Feel free to download and use the executable:

Download ChangeScreenResolution.exe 1.0.4 (26 KB)

Last update 2017-01-03

If you found this tool useful, please consider a donation:

Make a donation via PayPal :)

Please note, that you might need to install the Redistributable Packages for Visual Studio 2013 first, especially if you are on Windows 10. - Thanks to Nate

Usage

This tool allows you get information about your display adapters and set options for them.

Option overview

Group Parameter Description Example
get /l List all display devices
/m List all available modes
set /w=<width> Set the width in pixel /w=1024
/h=<height> Set the height in pixel /h=768
/f=<frequency> Set the image refresh rate /f=50
/b=<bpp> Set the bits per pixel (color depth) /b=16
filter /d=<device> Set/query only specified device (name or index) /d=0 or /d=\\.\DISPLAY1
other /log=<logfile> Write the program output to a logfile /log=C:\log.txt
/force Apply the registry update if at least one update was successful
/alternatives Show alternatives on adapter 0 if setting a resolution fails

Getting information

/l List display devices

ChangeScreenResolution.exe /l

The command lists all graphic cards with the connected monitors in the format:

[<INDEX>] <DISPLAY_NAME> <DISPLAY_STRING> <MONITOR_NAME> <MONITOR_STRING>

Variables:

Variable Description
<INDEX> The index of the graphic card, use eg for filter parameter /d
<DISPLAY_NAME> Identifier string of the display (graphic card), use eg for filter parameter /d
<DISPLAY_STRING> Description (model / brand) of the graphic card
<MONITOR_NAME> Identifier string of the monitor
<MONITOR_STRING> Description (model / brand) of the monitor

Example output:

Connected display devices: [0] \\.\DISPLAY1 Intel(R) HD Graphics 4600 \\.\DISPLAY1\Monitor0 PnP-Monitor (Standard) [1] \\.\DISPLAY2 Intel(R) HD Graphics 4600 \\.\DISPLAY2\Monitor0 PnP-Monitor (Standard) [2] \\.\DISPLAY3 Intel(R) HD Graphics 4600 [3] \\.\DISPLAYV1 RDPDD Chained DD [4] \\.\DISPLAYV2 RDP Encoder Mirror Driver [5] \\.\DISPLAYV3 RDP Reflector Display Driver

/m List modes

ChangeScreenResolution.exe /m

List only available modes for device with index 0:
ChangeScreenResolution.exe /m /d=0

The command lists all graphic cards with the connected monitors in the format:

Display modes for <DISPLAY_NAME>: <width>x<height> <bpp>bit @<frequency>Hz <fixed output> <width>x<height> <bpp>bit @<frequency>Hz <fixed output> [...] Display modes for <DISPLAY_NAME>: <width>x<height> <bpp>bit @<frequency>Hz <fixed output> [...]

Variables:

Variable Description
<DISPLAY_NAME> Identifier string of the display (graphic card)
<width> width in px of the mode
<height> height in px of the mode
<bpp> bits per pixel (color depth) of the mode
<frequency> frequency in Hz of the mode
<fixed output> fixed output mode (stretched, centered, default)

Example output:

Display modes for \\.\DISPLAY1: 320x200 8bit @59Hz centered 320x200 8bit @59Hz stretched 320x200 8bit @60Hz centered 320x200 8bit @60Hz stretched 320x200 16bit @59Hz centered 320x200 16bit @59Hz stretched 320x200 16bit @60Hz centered 320x200 16bit @60Hz stretched 320x200 32bit @59Hz centered 320x200 32bit @59Hz stretched 320x200 32bit @60Hz centered 320x200 32bit @60Hz stretched 320x240 8bit @59Hz centered 320x240 8bit @59Hz stretched 320x240 8bit @59Hz default [...] 1600x900 32bit @59Hz default 1600x900 32bit @60Hz centered 1600x900 32bit @60Hz stretched 1600x900 32bit @60Hz default 1680x1050 8bit @59Hz default 1680x1050 8bit @60Hz default 1680x1050 16bit @59Hz default 1680x1050 16bit @60Hz default 1680x1050 32bit @59Hz default 1680x1050 32bit @60Hz default Display modes for \\.\DISPLAY2: [...]

Setting display options

The software sets the new display options in two steps

  1. Update the options in the registry for every requested monitor
  2. Apply the registry updates

If the registry update fails, the software aborts and does not try to apply the changes (except with /force parameter.

Basic output

If you use a set parameter, the program outputs first the retrieved settings so you can see which changes it tries to set.

Example output:

c:\>ChangeScreenResolution.exe /b=24 /w=1024 Setting devices: - \\.\DISPLAY1 - \\.\DISPLAY2 - \\.\DISPLAY3 to the following parameters: - width = 1024 - color depth = 24 [...]

Return messages

Each of these steps can produce it's own status messages

  • The settings change was successful. (DISP_CHANGE_SUCCESSFUL)
  • The settings change was unsuccessful because the system is DualView capable. (DISP_CHANGE_BADDUALVIEW)
  • An invalid set of flags was passed in. (DISP_CHANGE_BADFLAGS)
  • The graphics mode is not supported. (DISP_CHANGE_BADMODE)
  • An invalid parameter was passed in. This can include an invalid flag or combination of flags. (DISP_CHANGE_BADPARAM)
  • The display driver failed the specified graphics mode. (DISP_CHANGE_FAILED)
  • Unable to write settings to the registry. (DISP_CHANGE_NOTUPDATED)
  • The computer must be restarted for the graphics mode to work. (DISP_CHANGE_RESTART)

Example: Failed to set display with index 0 to a width of 800px (because the current resolutions height has no matching width with 800px, eg current resolution is 1024x768px)
c:\>ChangeScreenResolution.exe /w=800 /d=0 Updating registry: [0] \\.\DISPLAY1: Error: The graphics mode is not supported. (DISP_CHANGE_BADMODE) Error during registry update. Aborting.

Example: Successfully set monitor with index 0 to a resolution of 1680x1050px
c:\>ChangeScreenResolution.exe /w=1680 /h=1050 /d=0 Updating registry: [0] \\.\DISPLAY1: The settings change was successful. (DISP_CHANGE_SUCCESSFUL) Applying changes. The settings change was successful. (DISP_CHANGE_SUCCESSFUL)

/w Set the resolution width

Set width to 800 px (/w=800) for all displays
ChangeScreenResolution.exe /w=800

Set width to 800 px (/w=800) and height to 600 px (/w=600) for all displays:
ChangeScreenResolution.exe /w=800 /h=600

Set width to 800 px (/w=800) and height to 600 px (/h=600) for display with index 0 (/d=0):
ChangeScreenResolution.exe /w=800 /h=600 /d=0

For example output see return messages.

/h Set the resolution height

Set height to 600 px (/h=600) for all displays
ChangeScreenResolution.exe /w=600

Set width to 800 px (/w=800) and height to 600 px (/h=600) for all displays:
ChangeScreenResolution.exe /w=800 /h=600

Set width to 800 px (/w=800) and height to 600 px (/h=600) for display with index 0 (/d=0):
ChangeScreenResolution.exe /w=800 /h=600 /d=0

For example output see return messages.

/f Set the displays refresh rate (frequency)

Set frequency to 60 Hz (/f=60) for all displays
ChangeScreenResolution.exe /f=60

Set width to 800 px (/w=800) and height to 600 px (/h=600) with a frequency of 60Hz (/f=60) for all displays:
ChangeScreenResolution.exe /w=800 /h=600 /f=60

Set width to 800 px (/w=800) and height to 600 px (/h=600) with a frequency of 59Hz (/f=59) for display with index 0 (/d=0):
ChangeScreenResolution.exe /w=800 /h=600 /f=59 /d=0

For example output see return messages.

/b Set the bits per pixel (color depth)

Set color depth to 32 bit (/b=32)
ChangeScreenResolution.exe /b=32

Set width to 800 px (/w=800) and height to 600 px (/h=600) with a color depth of 16 bit (/b=16) for all displays:
ChangeScreenResolution.exe /w=800 /h=600 /b=16

Set width to 800 px (/w=800) and height to 600 px (/h=600) with a color depth of 32 bit (/b=32) for display with index 0 (/d=0):
ChangeScreenResolution.exe /w=800 /h=600 /b=32 /d=0

For example output see return messages.

Filter options

You can filter which devices you want to query or set options for.

/d device filter

Available options for filtering
Filter method Example
Use all connected devices (default) /d=all (or simply omit parameter)
Get device by index (see parameter /l) /d=0
Get device by device name (see parameter /l) /d=\\.\DISPLAY1
Use multiple devices

You can also filter multiple devices by seperating them with a comma (,)

List modes (/m) for devices with index 1,3 and 4
ChangeScreenResolution.exe /m /d=1,3,4

Set width (/w=1024) and height (/h=768) for devices \\.\DISPLAY1 and \\.\DISPLAY2 (/d=\\.\DISPLAY1,\\.\DISPLAY2)
ChangeScreenResolution.exe /w=1024 /h=768 /d=\\.\DISPLAY1,\\.\DISPLAY2

For example output see the corresponding set or query parameter.

Other options

/log Write the program output to a logfile

Write the program output to c:\log.txt(/log=C:\log.txt)
ChangeScreenResolution.exe /log=C:\log.txt

/force Apply the registry update if at least one update was successful

This allows applying the registry update even if some updates failed.
Force applying the updates (/force)
ChangeScreenResolution.exe /force

/alternatives Show alternatives on adapter 0 if setting a resolution fails

List all alternatives for a specific width and height on adapter 0

List alternatives (/alternatives) for a resolution of 1024px (/w=1024) x 768px (/h=768) with a (not available) frequency of 10Hz (/f=10):
ChangeScreenResolution.exe /w=1024 /h=768 /f=10 /alternatives

Example output

c:\>ChangeScreenResolution.exe /w=1024 /h=768 /f=10 /alternatives Setting devices: - \\.\DISPLAY1 - \\.\DISPLAY2 - \\.\DISPLAY3 to the following parameters: - width = 1024 - height = 768 - frequency = 10 Updating registry: [0] \\.\DISPLAY1: Error: The graphics mode is not supported. (DISP_CHANGE_BADMODE) [1] \\.\DISPLAY2: Error: The graphics mode is not supported. (DISP_CHANGE_BADMODE) [2] \\.\DISPLAY3: Error: The graphics mode is not supported. (DISP_CHANGE_BADMODE) Error during registry update. Aborting. Possible alternatives for \\.\DISPLAY1 with 1024x768: 8bit 59Hz 8bit 60Hz 8bit 70Hz 8bit 75Hz 16bit 59Hz 16bit 60Hz 16bit 70Hz 16bit 75Hz 32bit 59Hz 32bit 60Hz 32bit 70Hz 32bit 75Hz Connected display devices: [0] \\.\DISPLAY1 Intel(R) HD Graphics 4600 \\.\DISPLAY1\Monitor0 PnP-Monitor (Standard) Settings: 1680x1050 32bit @59Hz default [1] \\.\DISPLAY2 Intel(R) HD Graphics 4600 \\.\DISPLAY2\Monitor0 PnP-Monitor (Standard) Settings: 1680x1050 32bit @60Hz default [2] \\.\DISPLAY3 Intel(R) HD Graphics 4600 [3] \\.\DISPLAYV1 RDPDD Chained DD [4] \\.\DISPLAYV2 RDP Encoder Mirror Driver [5] \\.\DISPLAYV3 RDP Reflector Display Driver

Error codes

After execution the application sets the %ERRORLEVEL% variable to:

value Reason
0 Success! Everything is all right
1 Did not recognize parameter
2 Error during registry update
0 Error during applying registry update

Alternatives