Setting the console title to be your current working directory

Setting the console title to be your current working directory

  • Comments 3

jmanning wrote:

Also, given how common the request is, I'd ask Jeffrey to (pretty-please) also include in this post a prompt function that sets the title to include pwd.

Ask and yea shall receive:

function Prompt
{
  $host.ui.RawUI.WindowTitle = $(get-location)
  "PS> "
}

If you want to see a bunch of great prompt examples, check out:

http://mshforfun.blogspot.com/2006/05/perfect-prompt-for-windows-powershell.html

Jeffrey Snover [MSFT]
Windows PowerShell/Aspen Architect
Visit the Windows PowerShell Team blog at:    http://blogs.msdn.com/PowerShell
Visit the Windows PowerShell ScriptCenter at:  http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx

 

PSMDTAG:FAQ:  How do I set the Console Title to my current working directory?

PSMDTAG:SHELL: Prompt

PSMDTAG:ENVIRONMENT: Prompt

Leave a Comment
  • Please add 8 and 1 and type the answer here:
  • Post
Page 1 of 1 (3 items)