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:
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.
|$E||Escape code||ASCII code 27|
|$H||Backspace||erases previous character|
|$P||Current drive and path|
|$V||Windows version number|
|$_||Carriage return and linefeed|
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.