Reset console window title after `run` executes a process


On Windows at least, it looks to me like certain executables like to set the console title (looking at you npm) while running, and the title doesn't get reset after the run is complete.

For example, if I run `npm version` in cmd.exe directly the title will change during execution, but gets reset afterwards. If I do the name thing via box.exe ( `!npm version`) the console window title will change to `npm` and it will not get reset afterwards. This has finally annoyed me enough to raise an issue.

I am not sure of the best solution - an easy one would just be to set the title after `run` completes, but that might be too rigid.


Brad Wood
May 1, 2020, 6:45 AM

I’ve noticed this too but never took the time to see how to change it. Turns out I just need to run

Have you only seen this issue on Windows?

John Berquist
May 1, 2020, 3:12 PM

I think it is Windows only, but I will check the next time I use a different OS.

Incidentally, you don’t need to run the Title command to set the console title, there is a terminal sequence for it that should work cross shells (though depending on the shell it may override it after the command), e.g.:

Probably in the end on Windows these do the same thing though, so….


Brad Wood
May 1, 2020, 3:33 PM

Ahh nice, let me try that. I had just googled it and the first couple results mentioned the title command, but I assumed there had to be some underlying ANSI escape for it.

Brad Wood
May 1, 2020, 3:51 PM


  • Outputting that sequence works in ConEMU

  • The same code doesn’t work in my Windows 7 cmd window. The text “←]0;CommandBox” is output and then the chr(7) which is “bell” just makes a beep, but the terminal title isn’t updated


  • Using systemOutput() works

  • using the print helper which funnels through JLine’s massaging of the ANSI escapes strips the leading chr(27) and just outputs the text “]0;CommandBox” and sounds the Bell in cmd but no bell sounds in ConEMU.

I have a feeling that last bullet point is a bug of sorts in JLine, I have no idea why the direct sequence doesn’t work in cmd, even bypassing JLine. I think I may just stick with the “title” command for now since it’s the only one that seems to work in both places.


John Berquist
May 1, 2020, 4:01 PM

chr(7) which is “bell” just makes a beep

Is this a problem? It sounds okay to me (pun intended).
cmd.exe must have gotten an upgrade between 7 and 10, or at least the version of 10 I am on.




Brad Wood


John Berquist



Affects versions


Fix versions