Stupid PowerShell Trick #3:
 
Do you hate the fact that the cursor ends up at the end of the path in the PowerShell shell?  Here’s a trick to make the prompt put a newline at the end of the path so that the caret always starts on the next line.
 
First, in your ‘My Documents’ folder create a directory called WindowsPowerShell, if it doesn’t already exist.  In the My DocumentsWindowsPowerShell directory, create a file called profile.ps1.  You can use this file to execute code when the shell starts up.  Edit the profile.ps1 file and add the following line to it:
function global:prompt {(get-location).path + "`n>"}
See, PowerShell allows you to link functions into the system.  Since there is no ‘Prompt’ command, you just have to override the global prompt function.  To put a new line in the text, we use `n as the escape character sequence.
 
This opens up a lot of cans of worms, but it’s interesting…
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s