Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
Note: There is also a PowerShell version available if anyone is interested. Over at StackOverflow they also solved the multimonitor problem – nixda Jun 7 '15 at 7:21
up vote 12 down vote accepted

Try this:

wmic desktopmonitor get screenheight, screenwidth

From within Cygwin:

cmd /c wmic desktopmonitor get screenheight, screenwidth

I'm not sure what tricks to use in order to use the output. Perhaps a temporary text file?

share|improve this answer
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 '11 at 9:30
@Zitrax: Now you tell me. – paradroid Apr 15 '11 at 9:52
Thanks again. It did not work when connecting with rdesktop (or ssh into cygwin) though. Would be great to have it in all those situations also. – Zitrax Apr 15 '11 at 20:16
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 '13 at 6:22

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)

share|improve this answer

use MultiMonitorTool:

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

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

share|improve this answer

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%
share|improve this answer

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%
share|improve this answer
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 '15 at 7:16

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.