ZF-7998: Windows console (cmd) can have arbitrary width

Issue Type: Docs: Problem Created: 2009-10-01T12:08:09.000+0000 Last Updated: 2012-11-20T20:53:13.000+0000 Status: Closed Fix version(s): Reporter: R S (falkon) Assignee: None Tags: - Zend_ProgressBar

Related issues: Attachments:


On the page… is written:

"[NOTE] Automatic console width recognition

shell_exec is required for this feature to work on *nix based systems. On windows, there is always a fixed terminal width of 80 character, so no recognition is required there."

But it is not true - also a windows console (cmd) can have arbitrary width! Try: - run cmd - right click on the window bar (top of the window) - choose 'Properties' (the last item in pop-up menu) - go to 3rd tab (I don't know, what's the english original :( maybe 'Layout'? ) - there you can tune 'buffer size' and the 'window size'.

So, I assume, that this misinformation affected not only documentation, but also the code of Zend_ProgressBar_Adapter_Console.


Posted by Ben Scholzen (dasprid) on 2009-10-01T17:06:11.000+0000

Interesting, didn't know that. Do you have an idea how to recognize the window width? Else I'll google around a bit myself.

Posted by R S (falkon) on 2009-10-02T13:19:47.000+0000

Unfortunatelly I don't have any idea :( But maybe you can try find information also about Windows PowerShell - more sophisticated shell than cmd. I think, it could offer some way, how to obtain window size, and maybe there could be some reference, how it is possible (or impossible) to get window size also for cmd window.

Posted by Robert Basic (robertbasic) on 2009-11-29T06:26:25.000+0000

When cmd.exe is started, you can type "mode con" which will give something like:

<pre class="highlight">
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Robert>mode con

Status for device CON:
    Lines:          300
    Columns:        80
    Keyboard rate:  31
    Keyboard delay: 1
    Code page:      437

C:\Documents and Settings\Robert>

The "Columns" is the screen buffer height and the "Lines" is the screen buffer width.

One can change those two values by executing something like:

<pre class="highlight">
mode con: lines=20 cols=50

this is only for the active window only and for the active session only, e.g., default values will be used on next startup. Also, when this is executed, the scrollbar is gone and the window resize/maximize feature is not working.

If you want to execute "mode con" right on cmd.exe's startup, run it like:

<pre class="highlight">
cmd.exe /k mode con


Posted by Rob Allen (rob) on 2012-11-20T20:53:13.000+0000

Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".

Feel free to re-open and provide a patch if you want to fix this issue.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.