6

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.

6 Answers 6

9

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.

4
  • 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. Nov 6, 2009 at 5:05
  • cygwin is definitely the way to go. You can even run X apps using it. Nov 6, 2009 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 Nov 6, 2009 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?). May 16, 2012 at 16:01
3

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

3
  • 1
    How does a console version of vim address any of the issues in the question?
    – nobody
    Aug 21, 2014 at 16:39
  • @AndrewMedico - What issues? Console version of vim runs in cmd on windows, therefore suffers from the same restrictions.
    – Rook
    Aug 22, 2014 at 15:41
  • 1
    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.
    – nobody
    Aug 22, 2014 at 15:50
1

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.

0

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.

0

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.

1
  • 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. Jan 23, 2010 at 20:50
0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .