Tags

I have found the more I get into web development, the more I come across tutorials and videos of developers using a Mac or Linux and notice some of the sweet customizations they can do in their environments. I then must make an attempt to replicate the awesomeness in Windows. So far I have been able to find a way each time, and the same is true for this little gem.

Here is how you can customize the windows command prompt to something a little bit more useful.

1. Create a new user environment variable named: ‘prompt’
2. Set the value to what you want as your command prompt.
3. Restart any command prompts you have open for them to pick-up the change.

and you’re done. It’s that simple.

When creating your custom command prompt, you can include any other environment variable that is already defined and it will render the result in your new prompt. You will need to use the following format:

%EnvironmentVariableName%

There are also a set of special characters you will need to know. There is a good list of these special characters at the bottom of the following post in a section called “Tips”, http://www.wikihow.com/Create-a-Custom-Windows-Command-Prompt. I have replicated them here for convenience.

$A & Ampersand
$B | pipe
$C ( Left parenthesis
$D Current date
$E Escape code ASCII code 27
$F ) Right parenthesis
$G > greater-than sign
$H Backspace erases previous character
$L < less-than sign
$N Current drive
$P Current drive and path
$Q = equal sign
$S space
$T Current Time
$V Windows version number
$_ Carriage return and linefeed
$$ $ dollar sign

Here is an example of what I have currently setup as my command prompt. Feel free to steal and modify it as you please.

$_%USERNAME%@%USERDOMAIN% $B $P$_$G 

note: There is also a space at the end so that the cursor start a space from the '>'

It ends up looking like something like this:

Paul@YOGA | C:\Users\Paul 
>  

Hope you find this as useful as I have.

Advertisements