I have seen several suggestions about programs to change the resolution from the command line. However I just want to display it, not change it.

On linux I can use xrandr or xdpyinfo to get this info, so I am looking for something like that.

I also need it to work within a cygwin shell.

  • 3
    Note: There is also a PowerShell version available if anyone is interested. Over at StackOverflow they also solved the multimonitor problem
    – nixda
    Jun 7, 2015 at 7:21

9 Answers 9


Try this:

wmic desktopmonitor get screenheight, screenwidth

From within Cygwin:

cmd /c wmic desktopmonitor get screenheight, screenwidth

EDIT: Update for later versions of Windows

wmic path Win32_VideoController get VideoModeDescription,CurrentVerticalResolution,CurrentHorizontalResolution /format:value

EDIT: wmic has been deprecated

In PowerShell:

 Get-CimInstance -ClassName Win32_VideoController | Select-Object VideoModeDescription

(using Get-CimInstance instead of Get-WmiObject as that may be deprecated too soon)

  • Yes thanks it works from cmd.exe. However I forgot to mention that I need this to work inside a cygwin shell and wmic do not seem to work there.
    – Zitrax
    Apr 15, 2011 at 9:30
  • 1
    @Zitrax: Now you tell me.
    – paradroid
    Apr 15, 2011 at 9:52
  • 2
    To me it doesn't work correctly with a multimonitor setup (it always returns the resolution of the 1st monitor, even if it is disabled) (My OS: WinXP).
    – eadmaster
    Nov 19, 2013 at 6:22
  • 4
    Does not work on Win8.1 or win10. It gives empty results for both screenheight and screenwidth. Feb 8, 2018 at 17:36
  • 2
    @paradroid It does not work, as explained in the other answer Feb 9, 2018 at 11:43

With dxdiag though it is not the fastest way:

@echo off

del ~.txt /q /f >nul 2>nul
start "" /w dxdiag /t ~
setlocal enableDelayedExpansion
set currmon=1 
for /f "tokens=2 delims=:" %%a in ('find "Current Mode:" ~.txt') do (
    echo Monitor !currmon! : %%a
    set /a currmon=currmon+1

del ~.txt /q /f >nul 2>nul

this will print the resolutions of all monitors.

Edit. The accepted answer uses WMIC. (wmic desktopmonitor get screenheight, screenwidth /format:value).This will not work on windows8/8.1/10. For the newer windows versions this can be used:

wmic path Win32_VideoController get VideoModeDescription,CurrentVerticalResolution,CurrentHorizontalResolution /format:value

A script that checks the windows version and then gets the resolution with the wmic:

@echo off

for /f "tokens=4,5 delims=. " %%a in ('ver') do set "version=%%a%%b"

if version lss 62 (
    ::set "wmic_query=wmic desktopmonitor get screenheight, screenwidth /format:value"
    for /f "tokens=* delims=" %%@ in ('wmic desktopmonitor get screenwidth /format:value') do (
        for /f "tokens=2 delims==" %%# in ("%%@") do set "x=%%#"
    for /f "tokens=* delims=" %%@ in ('wmic desktopmonitor get screenheight /format:value') do (
        for /f "tokens=2 delims==" %%# in ("%%@") do set "y=%%#"

) else (
    ::wmic path Win32_VideoController get VideoModeDescription,CurrentVerticalResolution,CurrentHorizontalResolution /format:value
    for /f "tokens=* delims=" %%@ in ('wmic path Win32_VideoController get CurrentHorizontalResolution  /format:value') do (
        for /f "tokens=2 delims==" %%# in ("%%@") do set "x=%%#"
    for /f "tokens=* delims=" %%@ in ('wmic path Win32_VideoController get CurrentVerticalResolution /format:value') do (
        for /f "tokens=2 delims==" %%# in ("%%@") do set "y=%%#"


echo Resolution %x%x%y%


Thank you @paradroid :) With WMIC, I wrote Batch Script to Remote Desktop not full screen but still convenient. ^_^

@echo off
if "%1"=="" goto :q01
set i01=wmic desktopmonitor
set i01=%i01% where availability^=3
set i01=%i01% get screenHeight,screenWidth
set o01=%temp%\ScrRes.txt
for /f "delims= skip=1" %%o in ('type %o01%') do call :p01 %1 %%o
goto :p99

set srvnm=%1
set /a tl=%2-40
set /a ll=%3-80
start mstsc /admin /w:%ll% /h:%tl% /v:%srvnm%
goto :eof

echo ^>^> Syntax: %0 MachineHostname [enter]

if exist "%o01%" del "%o01%" /f /q
echo ^>^> Sincerely Thank You For Using..
goto :eof

Feel free to explore. Feel enthusiast to enhance. (y)


use MultiMonitorTool:

MultiMonitorTool.exe /scomma "%TEMP%\MultiMonitorTool.csv"

then parse the file "%TEMP%\MultiMonitorTool.csv" (i'm still working on this)


the oldes answer does not seems to work anymore (win7 64bit); i solved that way

FOR /f "tokens=1,2" %%a IN ('"wmic desktopmonitor get screenheight, screenwidth"') DO (
    SET /a ScreenHeight=%%a
    SET /a ScreenWidth=%%b
echo %ScreenHeight%
echo %ScreenWidth%

For multi monitor setup just split the command:

set wmicheight="wmic desktopmonitor get screenheight /format:value"
set wmicwidth="wmic desktopmonitor get screenwidth /format:value"
for /f "tokens=2 delims==" %%a in ('%wmicheight%') do (
    If %%a LEQ 1 (
        rem skip if height is not bigger than 1
    ) Else (
        rem take the first height value larger than 1
        rem then skip to width
        Set /a "height=%%a"
        goto :width
for /f "tokens=2 delims==" %%a in ('%wmicwidth%') do (
    If %%a LEQ 1 (
        rem skip if width is not bigger than 1
    ) Else (
        rem add width found to get total width of all screens
        Set /a "width=width+%%a"
echo %width% x %height%
  • Please use code blocks. You've been a member here long enough to know how markdown works and how to make it look readable.
    – Karan
    Jun 7, 2015 at 7:16

The simplest way :

@echo off
::By SachaDee 2018

FOR /F "skip=2 delims=" %%a IN ('wmic path Win32_VideoController get VideoModeDescription^,CurrentHorizontalResolution^,CurrentVerticalResolution /format:Value ^| findstr ":"') do set %%a

echo Width =^> %CurrentHorizontalResolution%
echo Height =^> %CurrentVerticalResolution%
echo Description =^> %VideoModeDescription%
  • Can you give a little more explanation into what's going on here? I understand /format:Value returns results in a var=value form which is then used in the set command. If you just want one value, is there a way to do this without the for loop? Jun 19, 2018 at 14:40
  • If you just want to display the needed value, you can for sure just run a wmic query alone with the right parameters to just display the value. The for loop is used here to set the values for a later use in the code. That's the only way to do it in bat using an external command (wmic.exe in this case).
    – SachaDee
    Jun 19, 2018 at 21:14
  • You can't use set with a wmic result without a for loop? Jun 19, 2018 at 21:15
  • No its not possible !
    – SachaDee
    Jun 19, 2018 at 21:20

This is my try :

@echo off
Mode 45,3 & color 0A
Title Dislpay Resolution by Hackoo 2018
Set "WMIC_Command=wmic path Win32_VideoController get VideoModeDescription^,CurrentHorizontalResolution^,CurrentVerticalResolution /format:Value"
Set "H=CurrentHorizontalResolution"
Set "V=CurrentVerticalResolution"
Call :GetResolution %H% HorizontalResolution
Call :GetResolution %V% VerticalResolution
echo     Screen Resolution is : %HorizontalResolution% x %VerticalResolution%
pause>nul & Exit
FOR /F "tokens=2 delims==" %%I IN (
  '%WMIC_Command% ^| find /I "%~1" 2^>^nul'
) DO FOR /F "delims=" %%A IN ("%%I") DO SET "%2=%%A"
Exit /b

I had an instance where wmic didn't work at all. Autoit worked for me.

Local $sResolution = @DesktopWidth & 'x' & @DesktopHeight

If this doesn't work, check out these nuances.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .