32

For some reason the Windows command prompt is "special" in that you have to go to a properties dialog to resize it horizontally rather than just dragging the corner of the window like every other app. Unsurprisingly this feature made it into P-P-P-Powershell as well -- is there any way around this via command prompt replacement or Windows hackery?

Luke
  • 18,585
  • 24
  • 87
  • 110
  • 2
    It's actually an artifact of the Windows console subsystem and how it interacts with the GUI. The relevant functionality (including command history and function keys) is not shell-specific and works even in own console applications. Powershell just inherits all this from csrss (or conhost in later versions of Windows). – Joey Aug 01 '09 at 19:19
  • possible duplicate of [Is there a better Windows Console Window?](http://stackoverflow.com/questions/60950/is-there-a-better-windows-console-window) – Kevin Panko Jul 10 '14 at 15:23
  • Powershell is awesome as a "language" but it is constrained to pretty much the same terrible 90's console experience as cmd.exe – Piotr Owsiak Aug 21 '14 at 14:35
  • The question itself need editing. This whole thread is "Why is it so hard to resize a Windows command prompt console, and are the any alternate console applications?" – HiTechHiTouch Oct 27 '19 at 16:02
  • I read the original question as "Are there alternates to Windows cmd.exe which expand on what/how cmd.exe processes?" -- In other (unix) words, what alternative shells are available on windows? -- 4DOS/4NT JPsoft is the oldest I am aware of. – HiTechHiTouch Oct 27 '19 at 16:07
  • If getting the command history by pressing `Ctrl + R` is what you miss the most in `cmd.exe`, I suggest installing [CLink](https://mridgers.github.io/clink/). At the very bottom of [https://superuser.com/questions/1248999#1581575](https://superuser.com/questions/1248999#1581575) there is a direct link to the CLink installer. – Henke Aug 30 '20 at 11:15

8 Answers8

31

2019 Update:

  • Microsoft has released the terminal app on Github & the Windows Store, and it has tabs, panels, acrylic transparency, and other features.

2016 Update:

  • Windows 10's default conhost UI has more features, including free resize, transparency, etc (this includes cmd & powershell)
  • I now use ConEmu (walkthrough here) which has many features including tabs & split panes.
  • Other options include Cmder (which comes with additional tools built in), and ConsoleZ (a fork of Console2).
  • Console appears to no longer be updated
Factor Mystic
  • 26,279
  • 16
  • 79
  • 95
  • Console++ for eTerm-like transparency, but I can't resize the window.. should I be using the 1.5 or 2.0 release? – Luke Sep 30 '08 at 17:06
  • Ah, installed 2.00b140 and it has resizing and all the fanciness. – Luke Sep 30 '08 at 17:08
  • Hmm..only 5 minutes in and its already crashed on me. Beta was released in 2006 so it appears they're no longer actively developing. The search continues. – Luke Sep 30 '08 at 17:24
  • Looks like a new version was released in Mar 2009, so its getting some attention after all. – Luke Aug 01 '09 at 17:23
  • you're right - i was looking for Console! how u read my mind?? – Claudiu Nov 12 '12 at 22:38
  • I've tried many and ConEmu beats all competition! Gets you much closer to Linux console. I wish MS would finally improve in this area cause it feels like there's been no new features for over a decade while Linux console just rocks! – Piotr Owsiak Aug 21 '14 at 14:33
  • Oh, and BTW install clink in addition to ConEmu to get even more power. ConEmu + clink = pretty powerfull combo :D – Piotr Owsiak Aug 21 '14 at 14:33
12

I don't know if this is what you want: Resizing the Powershell Console Window. If so, I got this awhile ago: Just type: resize and use the arrow keys to adjust width and height.

##
## Author   : Roman Kuzmin
## Synopsis : Resize console window/buffer using arrow keys
##

function Size($w, $h)
{
    New-Object System.Management.Automation.Host.Size($w, $h)
}

function resize()
{
Write-Host '[Arrows] resize  [Esc] exit ...'
$ErrorActionPreference = 'SilentlyContinue'
for($ui = $Host.UI.RawUI;;) {
    $b = $ui.BufferSize
    $w = $ui.WindowSize
    switch($ui.ReadKey(6).VirtualKeyCode) {
        37 {
            $w = Size ($w.width - 1) $w.height
            $ui.WindowSize = $w
            $ui.BufferSize = Size $w.width $b.height
            break
        }
        39 {
            $w = Size ($w.width + 1) $w.height
            $ui.BufferSize = Size $w.width $b.height
            $ui.WindowSize = $w
            break
        }
        38 {
            $ui.WindowSize = Size $w.width ($w.height - 1)
            break
        }
        40 {
            $w = Size $w.width ($w.height + 1)
            if ($w.height -gt $b.height) {
                $ui.BufferSize = Size $b.width $w.height
            }
            $ui.WindowSize = $w
            break
        }
        27 {
            return
        }
    }
  }
}
avgbody
  • 1,382
  • 3
  • 15
  • 31
  • @atomizer I completely agree, this is insane, goes to my script folder immediately. ;D – mjsr Sep 20 '11 at 16:08
3

If you don't mind installing cygwin you can use it with xterm or rxvt. You'll also be able to use Bash as the shell instead of cmd.exe which is much nicer.

manicmethod
  • 886
  • 1
  • 8
  • 13
3

This isn't quite what you're looking for, but the way I get around it is by using cygwin's rootless X-Windows mode and XTerms. I prefer the unix command line environment more then Windows' env, and the XTerm windows act just like any other window.

As for straight replacements, a quick google search shows these:

I haven't tried them, so I'm not sure if they have what you're looking for, but they might be worth a shot.

Herms
  • 37,540
  • 12
  • 78
  • 101
2

Way after the fact, but things have improved in the meantime. ConEmu is highly configurable, and can be resized horizontally and vertically. It has the somewhat odd (to me anyway) behavior of resizing the font as the window is resized. There's some discussion about it here. And Scott Hanselman has written about it, including integration with FarManager.

Community
  • 1
  • 1
Tim Condit
  • 138
  • 4
2

PowerShell v2.0 ships with an interactive shell, called the PowerShell Integrated Script Environment (ISE). It's not fantastic, but it's usually better than the console subsystem.

Good

  • Includes a PowerShell script editor, with colorization

  • Colorization as a type at the prompt

  • I can have multiple PowerShell sessions, including remote sessions, as tabs.

  • The ISE is PowerShell-aware, so I can manipulate and extend it with PowerShell. For example, see the "IsePack", which adds a ton of features, including copy-as-HTML.

  • Can easily scale the text

  • Conventional Windows resizing, cursor navigation, selection, copy, paste, fonts, etc.

Bad

  • Interactive console applications block waiting for input, and thus hang.

  • Console applications that detect whether their standard IO are redirected will think that is so, and thus act oddly. The worst is TFS's tf.exe. For example, 'tf submit' will submit without prompting, even though the prompt is GUI, not CLI.

  • A limited feature set out of the box. It's obvious they would like to make a much richer PowerShell IDE but did not.

Jay Bazuzi
  • 45,157
  • 15
  • 111
  • 168
0

You might consider installing FAR. It's an excellent text mode file manager and much more. It could also be resized by dragging the corner of the window :)

Ilya Kochetov
  • 17,988
  • 6
  • 44
  • 60
0

If you set the property 'Layout/Screen Buffer Size/Width' then, when prompted, choose 'Modify shortcut that started this window' it will remember the buffer width. Then when you start another command prompt it will be, for example, the original 80 wide, but you can now stretch it to whatever you set the buffer width to.

Command Prompt will not wrap at the current window width, only at the buffer width. Thus if you've set the buffer width to 120, but the window is only 80 wide the lines will wrap at 120 and you'll have to scroll to read characters past 80.

Richard A
  • 2,783
  • 2
  • 22
  • 34