Is there a Windows command line with smart bash-like autocompletions / command history?
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.
Solution 1:
Download and install the Powershell 2.0 console (if you are using Windows 7, it is already installed).
It supports all the legacy commands as well as alias, macros and more...
Here are some basic tips.
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.
Solution 2:
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.