tags:

views:

461

answers:

4

I've been trying to switch over to PowerShell from my old favorite 4NT. It's missing a lot of niceties that 4NT has been adding over the last 20 years (I'm an old 4DOS user).

For example, in 4NT if you type a few letters then hit up/down, then the history list is filtered by what you typed. Page up/down does a popup with all matches and you can cursor through them. All in the console window space, no GUI. This is a big time-saver that I miss. There are many other things like this missing from powershell.exe.

Are there any alternatives to powershell.exe that perhaps have features like this, that really take advantage of the console environment? I realize there are a lot of GUI-based tools that embed PowerShell as a pane, but I'm really interested in a cmd.exe/4nt.exe replacement that stays as a 100% console application (except for maybe an options dialog or whatever).

+2  A: 

Powershell is still pretty new, so look for someone to implement some of these. For now, though, you can hit F7 to get a command history and select from that. The tab completion stuff in powershell is pretty powerful, too, and you can use wildcards to do command tab completion (even on partial cmdlet names).

Joshua Smith
+5  A: 

Joshua already mentioned F7. You can also do partial history matches in Powershell.exe by typing some of the command and pressing F8 - repeat F8 to cycle through matches (see about_history). There are also a few more line editing features than folks typically know about. These are documented in the about_line_editing help topic. Still, line editing in the PowerShell console host leaves something to be desired. FWIW all of the other hosts I'm aware of are GUI based.

BTW I was a 4NT user for years (as well as Korn shell user). Even with a few missing amenities found in 4NT, I find PowerShell a much more capable shell and, as a developer, all the "language" bits are pretty easy to adapt to and use. I never really liked the Korn shell if / fi and case / esac statements - just rubbed my sense of aethestics the wrong way. :-) Plus in PowerShell you can do cool stuff with your history like:

# Search history using regex
PS> get-history -count 999 | select-string '\b(fl|ft)\b'

# Look at your shell usage pattern by hour of day - Name column is hour of day
PS> ghy | group {$_.StartExecutionTime.Hour}

Count Name       Group
----- ----       -----
   30 21         {$allargs, echoargs -arg $allArgs, echoargs $a
    2 22         {ghy | group {$_.StartExecutionTime.Hour}, ls}

# Look at commands in terms of execution time (sorted descending)
PS> ghy | Select CommandLine,Id,`
      @{n='ExecutionTime';e={$_.EndExecutionTime - $_.StartExecutionTime}} | 
      Sort ExecutionTime -Desc 

CommandLine                                        Id ExecutionTime
-----------                                        -- -------------
ls C:\Windows\System32 ...                         94 00:00:06.0233445
ls C:\Windows\System32\...                         93 00:00:01.1360650
gps | fl                                           89 00:00:00.5780330
dir                                                80 00:00:00.0950054
ls                                                 83 00:00:00.0870050
ghy | Select CommandLin...                         92 00:00:00.0810046
dir                                                67 00:00:00.0750042
ghy | Select CommandLin...                         95 00:00:00.0580034
ghy | Select CommandLin...                         96 00:00:00.0570032
ghy | Select CommandLin...                         97 00:00:00.0540031
dir                                                76 00:00:00.0500029
get-history -count 999 ...                         88 00:00:00.0420024
Keith Hill
This is my third try to move over from 4NT and I'm going to make it stick this time. Good to know about F7/F8, thanks! Now if only ctrl-v had an equivalent shortcut so I don't have to reach for the mouse.. Perhaps autohotkey can help me fill in the gaps.
Scott Bilas
For paste, try Alt+Space,E,P - cheesy but it works.
Keith Hill
+2  A: 

Hey, you have the same history as me. I'm an old 4dos/4nt user too. I'm not a fan of the new fangled hosts that completely replace the console subsystem for input and that's why I like PowerShell Plus - at its core it's still the NT console but has many modern graphical features that can be pared back as desired.

http://www.idera.com/Products/PowerShell/PowerShell-Plus/

There's a 30 day trial available and the author Tobias Weltner is very responsive to help requests/suggestions.

-Oisin

x0n
Hey Oisin, I didn't know it used the console subsystem - cool. Guess all the fancy GUI windows threw me off. :-)
Keith Hill
+1  A: 

Check out PowerTab. It is a great (and free) add-on that gives you some really nice tab-completion features.

aphoria