Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

4 Answers 4

up vote 11 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
1  
@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
:p00
setlocal
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
%i01%>"%o01%"
for /f "delims= skip=1" %%o in ('type %o01%') do call :p01 %1 %%o
goto :p99

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

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

:p99
if exist "%o01%" del "%o01%" /f /q
echo.
echo ^>^> Sincerely Thank You For Using..
endlocal
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

Your Answer

 
discard

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.