I spend a lot of time at the command prompt and to be perfectly honest, I'm tired of looking at:
C:\Documents and Settings\Brian>
Or whatever directory I happen to be in. Back in the old DOS days we got rather creative with command prompts, usually through the use of ANSI to add colors. Colors aside, I wanted more information displayed (like date and time) and I wanted the directory information to not be in front of the line I'm entering commands on. When you go really deep down the directory chain, like:
C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\Master
The eye doesn't naturally follow. So I went back and looked up the reference for PROMPT. I finally settled on a prompt which is:
With this prompt setup, I get something like:
(Wed 02/20/2008 9:45) C:\
Breaking this down:
$C = (
$D = the date
$S = a space
$T = the time (formatted as HH:MM:SS.mm
$H is the backspace character (I only want to see HH:MM for the time, so I need to back space six times
$F = )
$P = directory listing
$_ = CR/LR
$G = >
You can set this by clicking on Start, right-clicking on My Computer, and choosing Properties from the pop-up menu. This should bring up a dialog window. Click on the Advanced tab and then click on the Environment Variables button. If you just want to set it for your user account, first scroll through the variables for the top window for the PROMPT variable, User variables for <username>. If you see it, click on it and then click the Edit button. If you don't, click on the Add button. Then enter the value you want for your prompt (for instance, $C$D$S$T$H$H$H$H$H$H$F$S$P$_$G$S). If you want it set for everyone, do the same, but scroll through and make the edit on the System variables window. Click OK twice to accept the settings.
Do you want to change the setting but aren't sure what you want? Open a command prompt and use:
You should see your changes immediately reflected. And in case you were wondering, the default value is $P$G (directory + >). So if you get something that's unreadable, you can get back to the default by either typing SET PROMPT= or SET PROMPT=$P$G.
On a related note, I didn't use anything ANSI related. In reality, I don't care about the pretty colors. Also, there is a modification that has to happen to CONFIG.NT I didn't want to deal with. But I believe you can use ANSI codes, if you want, provided you put ANSI support in.