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 recently started using bash, and discovered some really wonderful features (not necessarily come out of the box, but can be configured):

  • Up/down arrows support partial completion: Type "git ", press the UP arrow, and you'll get to browse through the recent commands that starts with "git " (even in previous sessions!)
  • Ctrl-R will search your command history (called reversed-i-search for some reason)
  • Many, many more I'm not aware of, I'm sure.

Is there a good cmd.exe alternative for Windows that supports such features? I've browsed through the top answers to this question, but didn't find if any of the popular alternatives support it.

share|improve this question
1  
Have you ever tried F7 in the command prompt? –  William Hilsum Aug 24 '11 at 12:10
    
I have not. And the first Google result (from 2005 no less!) is a Coding Horror! codinghorror.com/blog/2005/07/stupid-command-prompt-tricks.html Now just answer the other part of my question, and I'll be even more thrilled. –  ripper234 Aug 24 '11 at 12:14
1  
Unfortunately, Windows users generally use what the system comes with, and there's no popular cmd.exe replacement. Cygwin is widely used as a Linux "emulator" for Windows, you might give it a try. @William: nice didn't know that, but have you ever tried bash? Bash remembers commands of old sessions, not only current session. And also filters results as ripper234 states, not to talk about converting links into valid URLs, scrolling with mouse on terminal applications and a long list... And btw, why you still cannot horizontally resize the command prompt window? This will always puzzle me... –  m0skit0 Aug 24 '11 at 12:15
    
Two popular cmd replacements are discussed both below (by paradroid and RedGrittyBrick) and in the answers hyperlinked-to above, and your latter question is based upon an observably incorrect premise. I just used the mouse to horizontally resize a console window myself. –  JdeBP Aug 25 '11 at 6:53
add comment

6 Answers

Download the Powershell 2.0 console.

Edit If you are using Windows 7, it is already installed. /Edit

It supports all the legacy commands as well as alias, macros and more...

enter image description here

Here is a link to some basic tips, which I will cut and paste in.

Edit I decided not to cut and paste and trimmed some commands out that were common sense.

get-history: Displays a list of previously entered commands.

invoke-history 35: Executes command #35 in the get-history list

`:Press the backward apostrophe key to insert a line break or as an >escape character to make a literal character. You can also break a line at the pipe (|) character.

Alt+Space+E: Displays an editing shortcut menu with Mark, Copy, Paste, Select All, Scroll, and Find options. You can then press K for Mark, Y for Copy, P for Paste, S for Select All, L to scroll through the screen buffer, or F to search for text in the screen buffer. To copy the screen buffer to the Clipboard, press Alt+Space+E+S and then press Alt+Space+E+Y.

Alt+F7: Clears the command history.

Ctrl+C: Break out of the subprompt or terminate execution.

Ctrl + End : Delete all the characters in the line after the cursor.

Ctrl + Left Arrow || Ctrl + Right Arrow : Move left or right one word at a time.

Ctrl + S: Pause||resume the display of output.

Esc Clear the current line.

F1 Moves the cursor one character to the right on the command line. At the end of the line, inserts one character from the text of your last command.

F2 Creates a new command line by copying your last command line up to the character you type.

F3 Completes the command line with the content from your last command line, starting from the current cursor position to the end of the line.

F4 Deletes characters from your current command line, starting from the current cursor position up to the character you type.

F5 Scans backward through your command history.

F7: Similar to get-history. Displays a pop-up window with your command history and allows you to select a command. Use the arrow keys to scroll through the list. Press Enter to select a command to run, or press the Right arrow to place the text on the command line.

F8 Uses text you’ve entered to scan backward through your command history for commands that match the text you’ve typed so far on the command line.

F9 Runs a specific numbered command from your command history. Command numbers are listed when you press F7 or get-history.

Page Up || Page Down: Gets the first/last command in the command history.

Right-click If QuickEdit is disabled, displays an editing shortcut menu with Mark, Copy, Paste, Select All, Scroll, and Find options. To copy the screen buffer to the Clipboard, right-click, choose Select, and then press Enter.

Tab / Shift+Tab: Press the Tab key or press Shift+Tab to access the tab expansion function, which include folder or filename autocompletion.

share|improve this answer
    
Does it support partial history search? –  ripper234 Aug 24 '11 at 13:16
    
Yes, type the string you want to search and hit F8. –  surfasb Aug 25 '11 at 0:12
    
That's a very comprehensive overview of PowerShell keyboard controls. –  paradroid Aug 25 '11 at 1:20
    
I'll scrape up a list of must have Powershell modules later. . . –  surfasb Aug 25 '11 at 1:32
1  
@surfasb: You should include PowerTab, as it is relevant for this answer. Tabbing with it is like IntelliSense. –  paradroid Aug 25 '11 at 1:47
show 5 more comments

Clink extends the Windows command line and adds the following features

  • Powerful Bash-like line editing from GNU's Readline library
  • Superior path completion (TAB)
  • Paste from clipboard (Ctrl-V)
  • Support for the completion of executables/commands, and environment variables
  • Undo/Redo (Ctrl-_ or Ctrl-X, Ctrl-U) Improved command line history. Persists across sessions
  • Searchable (Ctrl-R and Ctrl-S). History expansion (e.g. !!, !, and !$). Scriptable completion using Lua.
share|improve this answer
    
Perfect. It makes cmd.exe so much more useful. –  beta Jul 10 '13 at 14:11
add comment

Win-Bash?

A stand-alone bash for Windows

win-bash is a windows port of the famous GNU bash (see GNU Bash homepage).

Unlike other bash ports for windows (e.g. the cygwin bash), the win-bash needs no special environment or DLLs. There is just one binary and that's it.

I'm not sure how functional and reliable this is.


There is also jpsoftware's take command - but, oops, that was mentioned in the other Q you mentioned, so presumably doesn't do what you want.

share|improve this answer
    
Actually, Take Command does do what xe wants. It has global command history that can be remembered even when no command interpreter is running. It has history list filtering and editing. My guess is that "the top answers" does not stretch to answer #5. ☺ –  JdeBP Aug 24 '11 at 21:49
    
@JdeBP - Take Command is about #12 on the list. –  ripper234 Aug 25 '11 at 6:05
    
SuperUser is listing it as the fifth answer when viewed here. –  JdeBP Aug 25 '11 at 6:44
1  
You can sort answers by "active", "oldest" or "votes". By "votes" is default and SuperUser then seems to randomise answers with equal votes - I find refreshing the page changes the order.. –  RedGrittyBrick Aug 25 '11 at 8:41
1  
@ripper234: What are you talking about? Win-Bash was updated last March. –  paradroid Sep 7 '11 at 5:30
show 3 more comments

You don't need to replace the Command Prompt! Windows has many of these features built into the Command Prompt, such as:

  • Command history: F7 and F9

  • Add 1 letter at a time from the previous command: F1

  • Auto completion of directories and filenames: Tab

There are even more tricks, but you will need to look further on Google as I couldnt find a website with a comprehensive list.

share|improve this answer
add comment

Take Command has already been mentioned, but TCC/LE (a subset) is a free CMD replacement with a lot more features, commands and customisability. It goes some way towards giving a bash-like experience, as far as keyboard shortcuts, aliases and colouring goes.

It can do the few things you mention, including partial history completion with Up/Down arrows. CTRL-B repeats path from the previous command. Try typing option to see a whole load of options.

TCC/LE also works very nicely within Console2.

Also, you can of course use bash on Windows with Cygwin.

share|improve this answer
add comment

The open-source PyCmd Command Prompt extension does most of what you ask for.

Its purpose is to emulate a few power features of UNIX shells (decent Tab-completion, persistent history, etc.).

image

share|improve this answer
add comment

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.