How can I replace the default program providing console windows under Windows XP?

I know of alternative programs, and I have a shortcut to start cmd.exe in Console2. But now I want console applications to start in Console2 rather than the default console program, even when I have no control over the program that starts the console application. (I.e. a non-console program starts consoleapp.exe, and I can't change it to start Console2 instead, but I still want the application to be started inside a new instance of Console2.)

(Note that I want to replace the console itself, that is, the window in which console (i.e. text mode) applications run. And I must be able to run arbitrary, unmodified console applications: a substitute for a specific console program such as Cmd won't do me any good.)

EDIT: So what I'm after is a CSRSS replacement, which leads to

OT: I want to know when Microsoft is going to make a decent CSRSS replacement. Not being able to adjust the width of a "terminal" by resizing the window is a complete joke.

Go download the ISE already. (It's included in Win7/2008R2.)

But as far as I understand this ISE is an environment for Powershell, not a general console emulator.

  • The deficiency mentioned in your new quote does not apply to CMD when it is run inside Console2, anyway, IIRC. – paradroid Sep 30 '10 at 18:33
  • @jason404: Yes but if you double-click a batch file, for instance, it will not open in Console2. Instances like this are where you could actually need to replace the command line shell. I think it's a great question, +1. – Sasha Chedygov Sep 30 '10 at 20:09
  • May be "Attach" of std console into new tab of console emulator suit you? Manual attach, I mean. – Maximus Jul 3 '12 at 20:51
  • @Maximus I don't understand what you're refering to. By “std console”, do you mean CSRSS? Where is that “attach” thing? – Gilles Jul 3 '12 at 20:59
  • ConEmu may attach any existing "real console" (CSRSS, yes) or simple GUI applications into its tab. Attach may be done manually from ConEmu interface, or by execution special command in console (if applicable). – Maximus Jul 3 '12 at 21:18

I'm an author of ConEmu - Windows console emulator. One of its features is capturing to its tab existing consoles or simple GUI applications. So, after starting console program in standard console (CSRSS/ConHost), you may:

  • In the ConEmu system menu, choose "Attach..." item (Win+G by default) and choose attaching window. If ConEmu was not started, you may optionally start it without creating console/tab on startup:

    C:\Tools\ConEmu.exe /detached
  • Or, if applicable, run in the started console the following command (ConEmu\Attach.cmd) which initiates attaching from console side. Note, in that case, ConEmu.exe (GUI) will be started automatically, if not already exists.

    ConEmuC.exe /ATTACH /NOCMD
  • There is one more way. I think it doesn't match your requirements, however I'll disclose it. There is a key in the registry, which contents cmd/tcc executes after console startup. While you are starting consoleapp.exe, not cmd.exe, this miss. There is Cmd_Autorun.cmd file in ConEmu distrib to install/uninstall this command.

    [HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
    "AutoRun"="\"<Command to be executed>\"" 

There is a tag here, on Superuser.com

UPD. Build 120704. Alternative nonintrusive attach mode for console windows.

ConEmu attach external console dialog

UPD2. Build 121128. It is possible to intercept "creation of console window" from specified (by user) applications, for example explorer.exe,vcexpress.exe. Read more about this intrusive experimental feature.

  • Looks promising, but it doesn't work for me (I suppose it might work for others). When I try to attach consoleapp.exe, I get the message ConEmuC.X, PID=5656 Injecting remote into PID=5432 FAILED, code=-111:0x00000057. Since consoleapp.exe is a program I'm debugging, seeing “injecting remote” makes me suspect that the technique used by ConEmu will never work for me — I can't allow “foreign” programs to perturb the program I'm debugging. – Gilles Jul 4 '12 at 12:35
  • Try build 120704. May be alternative mode will work for you. – Maximus Jul 4 '12 at 21:01
  • Build 120704 with alternative mode works, thanks. If I can't replace the default console emulator, attaching to a better one after the application is started is better than nothing. I can't figure out how do it in one key press, though. – Gilles Jul 5 '12 at 18:09
  • @Maximus: I can't help not to commend your great work. I rarely use Windows, but am sometimes forced to, and when I am, I need Cygwin or Msys integration. While Console2 had the nicest solution that I saw so far, it was somewhat clunky. ConEmu is very nice, but I wish for 2 things: 1. it should have a better support for profiles, i.e. it should have a manager for saving/deleting custom console profiles (e.g. calling sh directly; 2. it should allow splitting the window in multiple vertical/horizontal tabs and recall this custom tab arrangement on restart. – axel22 Jul 13 '12 at 22:07
  • @axel22: You may post wishes to ConEmu Issues. 1. There are profiles already. 2. In the roadmap. – Maximus Jul 13 '12 at 22:20

You can't. Win32 consoles always use the built-in console windows provided by CSRSS.

  • Thanks, now I know what I'm after is a CSRSS replacement. – Gilles Sep 30 '10 at 18:12
  • @Gilles: Good luck with that. (Actually, on Windows 7 much of its functionality has been moved into the kernel, but it still stays a "critical process", being core of Win32 subsystem and all that.) – grawity Sep 30 '10 at 18:24
  • @Gilles: Then use a different shell, as I said. The Win32 console is just the standard Windows terminal emulator. – paradroid Sep 30 '10 at 18:29
  • 1
    @jason404: And as Gilles said, it is not the shell (cmd.exe) but the console (terminal emulator) he's looking to replace, so that any program that uses console windows would use the replacement. – grawity Sep 30 '10 at 18:58
  • 2
    Windows 7's console window implementation has been moved out of csrss into conhost.exe. Sadly, it's still the same old UI, and as far as I know, its APIs are undocumented. More at blogs.technet.com/b/askperf/archive/2009/10/05/… – ak2 Sep 30 '10 at 20:10

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.