RSS

Console2 – A worthy cmd window replacement

This entry was posted on May 04 2008
I have spend a considerable amount of time trying to find a worthy cmd.exe window replacement in windows. I mean really, the default really really sucks! Its hard to believe that an operating system like Windows in its 30 years of existence has seen no reason to improve this facet of itself (well, that and Notepad, but thats another blog post).

Anywho, I have experimented with a few prompt replacements and have finally settled with Console2. This is an open source development effort, and is currently at version 2 (beta). I had a little bit of trouble with it and figured it deserved its own post, so here goes.

I downloaded the latest build from SourceForge’s repository (currently at build 120). You want this build because it adds all sorts of goodies over the stable (1.5) version. You don’t need the src zip. Having downloaded it to my default Downloads folder, and unzipped it (yes, there is no installation required) and double clicked Console.exe only to get the following error –

Woops! Apparently not that simple, eh? It seems that this is a dll that comes with .Net 2 (which I had installed) but for some reason Console2 could not find it. This may have to do something with the fact that I did not extract it into “Program Files”. In any case, had one issue to deal with. Get crankin’ (or Googling in this case :D )

Quick note here – If you are to get an error dialog like this, merely hitting Ctrl-C with the dialog active will copy to the Windows clipboard. Didn’t know that one, did ya?

Anyways, Google returned with a link to dll-files.com and I managed to get the dll file, which I downloaded the Console2 folder (which still remained in my downloads folder). Cool. Think I am done. Double click Console.exe file again to get the following –

Now, my first reaction was, WTF? I have the dll right there! But a closer inspection revealed that it was not the same dll! This one is MSVCR71.dll while the other one was MSVCP71.dll. Hmm… back to “crankin’”… Google again revealed the location, wash, rinse, repeat, dll now sits in my Console2 folder.

Ok. Hopefully I am done. Double click Console.exe and voila! There is the beautiful prompt. Thank you! Its beautiful. Resizable, copy-paste, nice looking fonts and colors, tabs (woohoo!). I have to admit, not a big fan of the transparency, so I changed Edit -> Settings… -> Appearance -> More -> Window transparency to None. Great.

After a few days of using it, I decided I liked it enough to venture into customizing it. As I mentioned earlier, I have a “projects” directory directly under the root, and prefer to have a console open at that location. Went to Edit -> Settings… -> Tabs, added a new tab, named it Projects (creative, don’t you think?) and pointed the open dir option to C:\projects. Hit Ok, and close Console.

Another quick note – Console does not seem to reload changes to its settings on the fly. If you make a change to the settings, you are better off restarting Console (thats been my experience anyways).

Click on File -> New tab -> Projects. Expecting a new tab? Nope. Console just hung on me. I had to go to the ProcessExplorer to kill it. I wonder what went wrong? Honestly, I never figured it out.

I figured I could always live without that. One thing I could not live without was Cygwin. So far, I had been using PuttyCyg as a prompt to Cygwin. I figured I could hook up Console to Cygwin. Again, Edit -> Settings… -> Tabs, added a new tab, named it Cygwin (yeah, I am that good), and this time pointed the “Shell” option to Cygwin.bat. Hit Ok, close Console.

Wash, rinse, repeat. Tried File -> New tab -> Cygwin, and guess what, Console freezes again!

I was reconsidering Console2 at this point. I could continue using PuttyCyg as the Cygwin prompt as I had been doing earlier. But being persistent (Ok, Ok, obstinate) I tried another tactic…

Rather than pointing the “Startup dir” or the “Shell” options to where I felt they would be most appropriate, I decided to hack the Console2 settings file directly. Console2 stores its settings in a console.xml file, which you can edit in any worthy text editor. This is what my xml file looks like (only the relevant portion) –

	<tab title="Projects">
		<console shell="cmd.exe /k cd c:\projects\" init_dir="">
		<cursor style="" r="255" g="255" b="255">
		<background type="0" r="0" g="0" b="0">
			<image file="" relative="0" extend="0" position="0" />
				<tint opacity="0" r="0" g="0" b="0"/>
			</image>
		</background>
	</tab>
	<tab title="Cygwin">
		<console shell="cmd.exe /k C:\utils\cygwin\Cygwin.bat" init_dir="">
		<cursor style="" r="255" g="255" b="255">
		<background type="0" r="0" g="0" b="0">
			<image file="" relative="0" extend="0" position="0">
				<tint opacity="0" r="0" g="0" b="0"/>
			</image>
		</background>
	</tab>

Restart Console, and everything works! Ctrl-2 opens a new command in my “projects” directory, Ctrl-3 opens a Cygwin prompt.

Now, I decided, it felt good. I think I got it doing kinda what I wanted it to do, so I went ahead and moved the folder from the downloads folder to my utils folder. Updated my shortcut in my “Quick Launch” menu, and when the right time came (which was a few seconds later) clicked the icon to get the exact same dll error that I got in the beginning! What is going on here people?!

Now I was really desperate, and hurt, and angry. I figured, take a copy of the two dll files and the console.xml file, paste it in my temp directory, and blast away the Console2 directory. Unzipped again, only this time I unzipped it right under my util folder. Pasted the dll files and console.xml, and clicked again. Everything works beautifully! My only explanation to this was that Console2 was holding on to the full path of the dll files, which previously was C:\…\downloads\Console2\xyz.dll, and that path no longer existed. I guess it makes sense. But now I am happy :D

Yet another quick note – Do not map your Ctrl-C to copy. The problem here is that Ctrl-C in cmd is mapped to canceling a running batch script. Rather, select the Edit -> Settings… -> Behavior “Copy on Select” option. You have to select to Copy, yes?

Hope this helped. Let me know how you managed to hack your Console2 install in the comments.


6 Responses to “Console2 – A worthy cmd window replacement”

  1. If I’m remebering correctly (it’s been a long time since I’ve used a windows box), the reason that the default console in Windows sucks so much is because they needed to keep backwards compatability for a whole bunch of things, and for some reason decided not to fork and give users a nice powerful shell.

    This means you get to be restricted to 80 columns, and can’t create a file named CON. Whooo.


  2. 16.December 2008

    Happy to find your article on Console2! The tabs will probably work in a later version of Console2; the current version is Beta. You might try running a second instance of Console2, which would amount to «installing» it a second time (into i.e. a different folder), instead of a single instance with tabs. That is less elegant, but at least you are able to configure the background colour or window size (or both) to remind you which Console2 applies to which purpose. I put the word install in quotes because Console2 is stand-alone and doesn’t really install, it just runs.

    By the time I found your article I’d already been working with Console2 for some weeks. For those who don’t know, a right-click on the interior of the Console2 window opens up the configuration menus. I’m very happy with a slightly transparent, deep forest-green background, golden-orange-y letters in Lucida Console 10. I keep to a configured-to-size-and-location window for Console2.

    While unlike you, I do not personally find CMD.exe to be all that bad; but I certainly don’t like the default window in which it appears. My dislike prompted me to give Console2 a try (it is a big improvement over the earlier Console (no number suffix to the earlier name). I was hugely surprised to see that I could specify (in the configuration menus) what shell I want to use. Well, now! — Hands down, that had to mean «TCC_LE», and since a year or so, a slightly scaled-back version is freeware. No nag screens. (http://www.jpsoft.com/tccledes.htm)

    JP Software is the same company which provided (and still provides) the «4DOS» replacement for command.com (it too is now freeware). — «TCC_LE» is by no means a crippled or trial version of a still-more-advanced version, but TCC_LE does not have absolutely everything in the pay-for.

    Everything I mention here I run from portable flash drive.

    It was a breeze to specify the shell. Please note: it is okay to specify absolute paths, i.e. without specifying a drive-letter. TCC_LE (whose executable is named «tcc.exe») comes with extensive documentation. Buried somewhere, but it is there, in that documentation is how to configure it. It turns out all a person has to do is (a) at the TCC prompt, type «cd.>tcmd.ini» [ENT] in the same folder where tcc.exe is; and (b) type «option» [ENT] at the tcc command-prompt. Configure away, and on save and exit the tcc configs get written to the (until now) zero-byte file you created in step (a). To make the Console2 colours work, switch off («un-tick», disable) ANSI COLORS under the «Windows» tab (in the config-menus, from «option»). Console2 provides the colors, but not if you do not switch off the ANSI with OPTION.

    One lets Console2 load (start) tcc.exe. This is key. In addition to the configuring under OPTION menus, an optional but very desirable file that TCC looks for on start-up is «TCSTART.cmd», which should be put in the same folder as tcc.exe and tcmd.ini. As with tcmd.ini, you yourself create a blank with the correct name, then write to it (from a batch file: the batch file does the writing) before you launch (with cmd.exe’s «start» command, in that same batch file) Console2. Have something like the following run in the folder where tcc.exe is. —

    @echo off

    The usual opener, of course.

    cd.>TCSTART.cmd

    Create a zero-lenth file that tcc.exe will look for and read when tcc.exe starts.

    echo set .txt;.ted=\_HTML\TedNPad.exe>>TCSTART.cmd

    I create what JPSoftware calls «executable extensions» for .txt and .ted. Typing a You_Name_It.txt filename at the prompt where You_Name_It.txt is located [ENT] loads You_Name_It.txt into Ted NotePad (which in my case I put in folder N:\_HTML, where N: is the letter a given site (host PC) assigns to my flash. Note that I do not specify the N:. It is enough to specify \_HTML. Ted Notepad has the rare feature of «commit word wrap» which puts hard returns to selected text, line by line, according to where text wraps for a given TedNP window width. Any such files where I’ve used commit-word-wrap I name to FileName.ted (nothing proprietary to TedNP about the .ted extension: frankly, I made it up). For any .txt or .ted file, I type in Console2 (with tcc.exe as shell) the initial letters of a .txt or .ted filename and press TAB for autocompletion. If I TAB too far past the file I want, I do SHIFT+TAB to put the engine in reverse and go back.

    echo cd..>>TCSTART.cmd
    echo cls>>TCSTART.cmd

    In my case I want Console2 and tcc.exe to display the opening prompt in the parent directory of tcc.exe (and of tcmd.ini and TCSTART.cmd). Users will modify accordingly. Best to not change drives. To prove you’re running tcc.exe, type «echo %comspec%» [ENT].

    Now start console.exe. I locate Console2’s files in a subdir of \_HTML. Users will modify accordingly. Keep to same drive (flash, HD partition).

    start \_HTML\Console_2\console.exe
    exit /B

    I end with an «exit /B» because all of the above I CALL from another .bat.

    The one thing I miss with tcc.exe is a «find» command. The work-around I use is to create a secondary batch-file (call it secondBat.bat) with whatever I need to do with «find», including creating a marker-file such as Yes_Thats_True.txt or No_Its_Not.txt according to what (ahem) «find» finds (or doesn’t find). Then from the batch file running under tcc.exe, I do this:

    cmd /k (call secondBat.bat)

    which opens a cmd.exe shell for the purpose of running secondBat.bat. SecondBat.bat must end in a full «exit» and not an exit /B so that the CMD /K «knows» that the CALL is completed. Once the call is over with, %comspec% is back to tcc.exe.

    Tcc.exe gives a lot of bells-and-whistles. Those who want full-blown UNIX bells-and-whistles will of course run a shell under Cygwin. I am myself putting that off, since I’d have to get a specifically portable-from-flash Cygwin running, which I hear tell can be done. In the meantime tcc.exe gives me such niceties as copy file1.ext file2.ext … fileN.ext [N:]\path_to_destination (where N: needs specifying only if it’s a different drive. Tcc.exe also gives me «cd -» (very Unix-y) namely change to the directory you were at before you came to the present directory.

    Thanks especially for including your code whereby you modified the XML file. If I ever need to go this far under the hood to configure Console2, it’s great to know how to do it.

    For me, TCC.exe (with occasional calls to CMD.exe) and Console2 bring back the good old days of (4)DOS. It’s almost as good as running Linux or BSD with an XTerm or an RXVT console window.

    Yours sincerely,

    Roger


  3. > Console2 stores its settings in a console.xml file, which you can edit ..

    It is worth mentioning that the XML file is located in the Console installation directory as a sibling of Console.exe. It is obvious in hindsight, but took me a while to figure out. :-)


  4. thanks for the post, got cygwin working!!!! and with cool background image


  5. When I had to use Windows I ended up doing the majority of my shell work in Emacs shell-mode. This actually translated to doing the same thing in Linux as well. In fact with a little lisp it is trivial to start servers that I need for work and have convenient access to them all within Emacs.

    There are definitely some quirks, but overall it was a pretty decent solution.


  1. 1 Trackback(s)

  2. Console is not showing the menu bar or the toolbar! « b b b

Post a Comment