views:

7463

answers:

14

UPDATE (solution)

Months later someone turned me on to an awesome solution to this. If you install Git for Windows, it comes with this console app called Git Bash that does exactly what I descibed. I gather that it is derived from MinGW. It's easy and convenient and gives you all the Unix bash command line conveniences. Tab-completion works the way it does in bash (completes up to the point of ambiguity and doesn't try to guess beyond that forcing you to backspace out of an incorrect completion) and you can control-R to search command history, and history is preserved across restarts.


Can someone recommend a Windows XP program that provides a command line environment? I am an avid Cygwin user, but it doesn't solve my current problem. The problem with Cygwin that's tripping me up is that paths within the Cygwin environment are different from those under Windows, so some things I need to do are failing. My current project requires the Windows environment, not an alternate universe.

I've also considered PowerShell and Windows Services for Unix. I might try them later but for this project, I don't have time to learn a whole programming language that is PowerShell, and I suspect that WSU will have the same path problem as Cywin.

What I'm really looking for to solve my current problem is an app that gives me a Windows console but with some basic amenities added such as...

  • Tab-completion.
  • Being able to cut and paste text appearing in the window.
  • Search command history.
  • Being able to make the window wider than 80 chars.
+1  A: 

I love powershell, and if you've got any experience with .Net, it's not so bad. I think that you will have to learn "a language" with any shell environment you choose.

scottm
+8  A: 

Powershell is a new language, but it meets all of your requirements and the vast majority of the commands that you are familiar with form the regular command prompt work just fine in a powershell prompt as well.

Since working with the history is so handy, I thought that I would provide a demonstration scenario here. Lets say that you have a bunch of batch files that you run in a specific order as part of your build (don't know why you haven't wrapped them up in another bat yet, but that's your problem :P ). You did a build this morning and it is now 8 hours and a butt load of commands later and you want to run them again. You know that they are in a folder called C:\Dev\Build and that they are the only bats that you have run out of that folder this session. So, here is the commandline that would run them again in exactly the same order that you ran them the first time:

ghy | ?{$_.CommandLine -like "C:\Dev\Build\*.bat"} | %{ihy $_.ID}
EBGreen
+18  A: 

The windows console provides the above features. Right click the title bar and choose properties. Select Quick Edit Mode and Insert Mode and command history on the options tab. Set your screen buffer and screen size on the layout tab. When you OK out modify shortcut that started that window and OK

K

defaulthtm
I don't know of any way to search the history in the regular command prompt.
EBGreen
Could you clarify this sentence: "When you OK out modify shortcut that started that window and OK"?
Ethan
After changing the options and clicking OK. A dialog box will appear asking if you want the changes to apply to only this window, or to apply the changes to future windows with the same title. Selecting the latter will ensure you have the features next time you open the command prompt.
Dillie-O
Now that's clarity. Thanks.
Ethan
One other note. While it isn't exactly "searching" the history, you can press the up arrow and get all previous commands you have entered. However, this only applies to the current command prompt window and the commands entered since it was opened.
Dillie-O
@EBGreen, I don't know of any console for any platform that allows "searching" the command history. Windows cmd.exe gives you command history revisiting (probably what the OP was after) with the up/down keys as many unix shells do (where the history's sometimes stored in a searchable text file).
BQ
Powershell gives the ability to search the history.
EBGreen
Including if you want it to it will keep a running transcript of STDOUT, STDIN, and STDERR for the console in a text file for later searching.
EBGreen
@BQ: bash and other shells have much more powerful history-management facilities, ranging from just reading it to selecting commands in it by number or content...
Adriano Varoli Piazza
F7 shows your command prompt history in a handly little window
Dynite
which is quite useful but gets less so if you spend all day in a console and you have 100+ commands in your history.
EBGreen
@Adriano, @EBGreen... thanks. Hadn't used bash in ~10 years, so my knowledge is dated. Just remember it storing history in a text file at the time. @Dynite, cool feature! Hadn't seen that before. Thanks!
BQ
So we have arrived at the option to use something like bash on Windows: http://win-bash.sourceforge.net/
innaM
Well the highest voted answer is to use cmd.exe so I'm not sure where you got bash clone as the end point.
EBGreen
F8 will search the command history for the latest command with a matching prefix to what you've already typed.
Greg Hewgill
Well that does work...sort of. It only works if you give it the beginning of the command. There is no wildcard support. On XP at least, it doesn't give you a list of results, it just cycles through the matches.
EBGreen
A: 

How about a good text editor like TextPad? It will give you many of the features you want and you can use whatever shell language you want. Textpad has some pretty nice command line integration features and compiler support.

Andrew Cowenhoven
+5  A: 

I'm pretty sure that Win XP has tab completion turned on by default, but Microsoft explains how to fiddle with that feature.

Scott W
+3  A: 

You can do most of this with the Windows console.

  1. Open a console window
  2. Click on the Icon in the upper left
  3. Click Defaults
  4. Under Options check QuickEdit Mode and Insert Mode
  5. Under Font, select a size and font you like
  6. Under Layout, make the window bigger
  7. Change the colors if you like.

This will give you everything you asked for.

Rob Prouse
Pretty sure that doesn't give the ability to search history.
EBGreen
To search history, type some characters and then F8.
Greg Hewgill
Well that does work...sort of. It only works if you give it the beginning of the command. There is no wildcard support. On XP at least, it doesn't give you a list of results, it just cycles through the matches.
EBGreen
+11  A: 

We use an older product called 4NT, made by a company called JPSoft. While it's an older product, I believe it does everything you are looking for (except perhaps being able to make the window wider than 80 chars), plus a bit more.

JPSoft has replaced 4NT with a product that is now offered free-of-charge: Take Command Console LE. Despite being free, it does everything we need it to do. I would highly recommend it!

Jedidiah Thomet
+7  A: 

MinGW is a smaller version (fork) of cygwin. The MSYS console is a rxvt shell running bash that has access to the Windows path.

Scott Hoffman
+31  A: 

There is also Console: http://sourceforge.net/projects/console/ it is a replacement for the Windows console window and much more flexible (tabs, transparency, presets, etc) For a better tab completion you need a different command interpreter like 4nt / take command.

Burnstreet
This is the only real answer to this question.
Max Howell
Too bad it doesn't support easy window resizing.
Milen A. Radev
What do you mean Console2 doesn't support easy window resizing? I've been using it ever since I found out about it from this thread 6 months ago -- never had a problem resizing any windows.
Noah Sussman
A: 

Powershell seems to have taken the "let's give'em the feature, but make it as complicated as we can" route, re:history.

You have a history list, but it's not on by default IIRC, it's complicated to use (get-history followed by invoke-history ? WTF?) They've promised to get this better in future releases, but they always do that.

Adriano Varoli Piazza
It is on by default and get-history has a default alias of h.
EBGreen
Oh, and Invoke-History has a default alias of ihy.
EBGreen
Nice. And F7, I read on another answer, shows a window with the current session's history.
Adriano Varoli Piazza
That works for powershell or cmd.
EBGreen
And F8 does a history search for commands starting with what you've already typed.
Greg Hewgill
Well that does work...sort of. It only works if you give it the beginning of the command. There is no wildcard support. On XP at least, it doesn't give you a list of results, it just cycles through the matches.
EBGreen
better and better. I bet there's even a manual for this stuff :)
Adriano Varoli Piazza
For the command prompt stuff?
EBGreen
Indeed. But I was just joking.
Adriano Varoli Piazza
+5  A: 

There are two categories here - one is done by the console window, the other is done by shell that is running in the window

  • Being able to cut and paste text appearing in the window.
  • Being able to make the window wider than 80 chars.

This is done by the window, and other answers explain how to set up the normal Windows console to do it. Cur and Paste sort of work, except the console is not aware of line continuation, so lines that are wrapped come out as two lines. To get a better window, try something form Putty. (Edit: color me wrong - Putty still does not supply console window. Oh well, plenty other options in the answers here. And, in case it was not mentioned, there is this. Can't vouch for it personally, but it's out there.).

  • Tab-completion.
  • Search command history.

This is done by shell, cmd.exe. Tab completion works (as explained in other questions). Search command history is not there. Nor is command history preserved between sessions. YOu can get a better shell, such as bash.

Another edit: I completely forgot about the excellent emacs shell mode. In Windows, that runs cmd.exe and provides great console window. It even enhances the tab completion for you! You can learn about emacs for Windows here.

Arkadiy
+6  A: 

I use Console2 with cmd.exe and/or a cygwin prompt. It's the bomb.

EDIT: started using it with TCC/LE (the modern-day incarnation of 4dos and 4nt), much better than cmd.exe and freeware.

orip
A: 

Try rxvt. It comes with Cygwin and it is awesome.

Nick Brooks
+1  A: 

Since spring this year (2010) there is also MinTTY included in standard Cygwin. Try this, it really convinced me (long term cmd and Console2 user). You don't need a running X server for it.

Boldewyn