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'm developer who was "born and bred" on Linux and BSD systems, and I've become accustomed to having advanced tools for the console (posix shells like bash, for example). My career has taken a twist that means I'm working in a Windows environment most of the time, and the console capabilities are really poor by comparison. The traditional windows console environment is a complete joke, and even most of the third party attempts at improving things aren't a lot better. PowerShell is a huge step in the right direction, but the console applications themselves are still way behind where unix has been for 20 years.

Does anyone know of a PowerShell console application that supports advanced command line editing like posix shells do? I'm particularly interested in emacs-mode editing, and I'd also like to be able to resize my window to an arbirary size, unlike the native console app that comes with Windows.

share|improve this question

6 Answers 6

Not exactly what you're asking for, but have you considered Cygwin? You'll feel right at home.

You can also run PowerShell as a shell within emacs.

share|improve this answer
2  
+1 I would also recommend cygwin for this person, since unix is what they are familiar with already. Also Ben, you can adjust the properties of the cmd shell to be (almost) any size you want, but I agree it's not anything like resizing a terminal in *nix. –  DaveParillo Nov 6 '09 at 5:05
    
cygwin is definitely the way to go. You can even run X apps using it. –  JohnnyLambada Nov 6 '09 at 7:26
    
another option, if they want to go there, is the Subsystem for Unix Applications and the Interix tools. This gives things like Bash, Csh, Zsh, and other *nix tools without needing the emulation layer of Cygwin –  Jim Deville Nov 6 '09 at 7:58
    
Cygwin isn't really what I'm looking for because it's not native to Windows, and will therefore always be crippled in a way that prevents it from ever being on Windows what the shell is on *nix. PowerShell is really the way to go on Windows, but the problem is the hosting applications suck (I mean really: didn't Xerox solve the window resizing problem like 30 years ago?). –  Ben Collins May 16 '12 at 16:01

It's not emacs, but vim has a console version.

Haven't used it on windows, so can't comment on its usability, though.

Vim (console version)

Apart from that, these make cmd a little more enjoyable.

Console2
PowerCmd

share|improve this answer
1  
+1 for console2, can't live without it –  Ben Nov 6 '09 at 10:25
    
How does a console version of vim address any of the issues in the question? –  Andrew Medico Aug 21 at 16:39
    
@AndrewMedico - What issues? Console version of vim runs in cmd on windows, therefore suffers from the same restrictions. –  ldigas Aug 22 at 15:41
    
The question isn't asking for a non-GUI text editor. It's asking how to get advanced functionality for the text currently on the shell command line (as an example, bash supports Ctrl-W to delete the whole word to the left of the cursor. cmd.exe doesn't have anything like that by default). The existence of a console version of vim for Windows in no way helps with that. –  Andrew Medico Aug 22 at 15:50

There is PowerGui.

My impression is that there are not many alternatives to the built-in PowerShell ISE.

With VBScript people used to write to me every other week with a new Editor, but with PowerShell - no offerings.

share|improve this answer

You can dynamically adjust your window size by manipulating the $host.ui.rawui.WindowSize property.

Use a function like this in your profile

Function Set-WindowSize { 
Param([int]$x=$host.ui.rawui.windowsize.width, [int]$y=$host.ui.rawui.windowsize.heigth)

$size=New-Object System.Management.Automation.Host.Size($x,$y)
$host.ui.rawui.WindowSize=$size
}

Then call the function:

Set-WindowSize 100 50

There's a lot you can do right from the console, for example, creating functions on the fly:

PS C:\> Function Try-Me {
>> write-host "Hello $env:username"
>> get-date
>> }
>>
PS C:\> try-me
Hello Jeff

Monday, November 09, 2009 1:08:13 PM

PowerShell's cmdlets can also do so much more. What used to take a 20 line script can now be accomplished with a one line PowerShell expression. Finally, because PowerShell is an object-based shell, you'll get much more out of a scripting IDE like PrimalScript, than merely editing text in the console.

share|improve this answer
    
Yes, this is all very interesting, but what I mean by "advanced editing" is the ability to edit my command line in place from the home row, including copy/paste, backreferences to history, etc. as supported in most terminals in POSIX systems. –  Ben Collins Jan 23 '10 at 20:50

The best you can get is if you install ConEmu and clink or go the Cygwin route.

BTW. I like how you call cmd.exe a joke and it being over 20 years behind linux - I feel the same way and actually think about moving to Linux for great console and scripting experience plus all my favourite IDEs and tools are there already (WebStorm, PyCharm, Vim, python, nodejs, Firefox, etc.) the only things I'll miss are Total Commander and AutoHotKey.

share|improve this answer
up vote 0 down vote accepted

After all this time, I have finally found a solution I like: ConEmu + Clink. And not just ConEmu, but Ethan Brown's ConEmu config:

enter image description here

This can be installed through Chocolatey. I highly recommend this configuration; ConEmu is great, but configuring it to something that looks nice is a chore. Here's how you install

PS> choco install EthanBrown.ConEmuConfig

Also, note that I'm using Clink as well, which provides a GNU readline-like line editing capability which I am thoroughly enjoying. Clink is available like this:

PS> choco install Clink

The Clink installer will edit your $profile for you to inject it into the running host process.

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.