INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Customizing PowerShell

Shortening the PowerShell Prompt by markdmac
Posted: 17 Apr 15

Greetings PowerShell Enthusiasts!

I’m practically bouncing off the walls (I am so easily amused) over a new profile change I just made. I’ve added this to both my ISE and non ISE PowerShell profiles. What this will do is keep your display prompt at PS> and the top of the window will then show your current location. No longer do you need to suffer through a prompt that is ever growing in length as you change directories.

To access your profile easily to add this code at the end, simply open PowerShell or PowerShell_ISE and at the prompt type NotePad $Profile and press enter. Paste this code at the bottom of the profile page and save it.


CODE --> PowerShell

function prompt
{
  'PS> '
  $host.UI.RawUI.WindowTitle = Get-Location
} 
Close and re-open PowerShell and do a happy dance when you see how your prompt now behaves.

Back to PowerShell (Microsoft) FAQ Index
Back to PowerShell (Microsoft) Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close