Wednesday, January 12, 2005

My New Prompt

Courtesy of the clever Shawn Van Ness, my new command-line prompt is now


$P$_$+$G


Which, when I set it via either the prompt command or the PROMPT environment variable, gives me a command line that looks like this:


C:\data\Projects\flexwiki\FlexWikiCore
++>


The plusses indicate that I'm two levels deep in pushd, and I like that the working directory appears on the line before, obliterating the problem of long paths making commands linewrap. Nice!

16 comments:

  1. How do you get the prompt setting to persist?



    Thanks!

    ReplyDelete
  2. By setting the PROMPT environment variable.

    ReplyDelete
  3. That was it - thanks!

    ReplyDelete
  4. I find this somehow both cool and disturbing at the same time. ;) Not sure if my brain can handle two line command prompts after all these years.

    ReplyDelete
  5. Hmmm. I don't get the pluses, no matter how deep I go into a directory. I set my PROMPT environment variable to $P$_$+$G.

    ReplyDelete
  6. George, try "Pushd" and "popd"

    (I'm a commandline freak myself).



    Try this press F7 on a dos window.

    ReplyDelete
  7. [%computername%] $d$s$t$_$p$_$_$+$g

    ReplyDelete
  8. That's a bit too much for me.



    what I am curious about is how one would go about setting the prompt color to something other than the default. I'd like it to stand out a bit.

    ReplyDelete
  9. Craig,



    The way you'd do that is



    color 8f.



    For more command line tricks from another command line junkie (me) - check my blog at -



    http://codebetter.com/blogs/sahil.malik/archive/2005/01/28/48715.aspx

    ReplyDelete
  10. Oh sorry .. I fast read .. you meant "prompt" color ..



    That's over here - http://kb.indiana.edu/data/aamm.html?cust=06626097.706.30

    ReplyDelete
  11. That's how you change your prompt color in DOS. I'm not running DOS - haven't for years. I'm using the Windows 2003 command shell. Ian Griffiths writes at length about the difference here: http://www.interact-sw.co.uk/iangblog/2004/03/04/notdos

    ReplyDelete
  12. Change your prompt color using ANSI commands. Probably doesn't work in plain-vanilla CMD, but works mighty fine with TakeCommand/32 :) (http://jpsoft.com/tcmddes.htm).

    ReplyDelete
  13. I use this one:



    @set prompt================================================================================$_$P\$_-------------------------------------------------------------------------------$_$D$T$G

    ReplyDelete
  14. p{color:black;} I am a self confessed Command Line Junkie. Here are a few tricks I use commonly that I can think off the top of my head. 1. Find a file on your hard disk - (This beats the Search doggie in ...

    ReplyDelete
  15. This did the trick.. Thanks a lot Craig..

    ReplyDelete
  16. I've got an .exe (batch, just converted. Not made by me but by my friend.) that does this this. I'm trying to recreate it inside a project of my own but i can't figure out how he has manged to be able to change the title permanently and also the color. Anybody care to help ? Please email me at backtrack@stoned.com. Thanks for your time.

    ReplyDelete