Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm a rather happy user of clink via the great cmder package. The only thing I miss is an easy way to set the command promt to display the current date/time (and last exit code, history number, as in bash... etc).

Could someone point me to the right direction on how to do this?

share|improve this question
Can you just use the Windows date /t? Also, Windows stores the last exit code in %errorlevel%, while sh uses $?. Try those. – Bob Jan 16 '14 at 14:11
But how to integrate that output to the prompt? I don't want to run date /t every time before running some long-running command. – Zsolt Botykai Jan 16 '14 at 14:33
Oh. Go see prompt /?, there's a date and time option in there. Again, that's standard Windows command prompt - I have no idea what clink or cmder do. – Bob Jan 16 '14 at 14:43
up vote 7 down vote accepted

Try this prompt settings (example only, it's show how you can call any console application inside "prompt printing"). Note! It works in ConEmu only.

prompt $p$s$e]9;7;"cmd /c echo (%DATE% %TIME%)"$e\$g

But, as Bob said, there is an easier way:

prompt $p$s$d$s$t$s$g

And for cmder you should edit the supplied init.bat as that defines the prompt settings.

share|improve this answer
For cmder, the suggested way to edit prompt settings is in %CMDER_ROOT%\config\user-startup.cmd and not init.bat. – wegry Jun 30 at 13:23
On win7 with Cmder, adding $t did the trick for me : @prompt $E[1;32;40m$P$S{git}{hg} $t$S$_$E[1;30;40m{lamb}$S$E[0m – Benj Jul 21 at 9:32
@wegry this %CMDER_ROOT%\config\user-startup.cmd file didn't seem to have any effect on my configuration. Maybe was I doing it wrong. – Benj Jul 21 at 9:33
@Benj It didn't seem to work for me at first either, but a restart later it did? I'm mystified by what made start working. – wegry Jul 21 at 12:51
@wegry Well, let's say both methods are OK... – Benj Jul 22 at 9:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .