Prompt with history count and console title


posted by Richard Giles
02-17-2009

Downloads: 271
File size: 782 B
Views: 781

Embed
Prompt with history count and console title
  1. <?xml version="1.0"?> 
  2. <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"
  3.     <CodeSnippet Format="1.0.0"
  4.         <Header> 
  5.             <Title>Prompt with history count and console title</Title> 
  6.             <Shortcut /
  7.             <Description>Replaces the prompt with the current command history id and displays the current path in the console title bar</Description> 
  8.             <Author>Dr. Tobias Weltner http://www.powershell.de</Author> 
  9.             <SnippetTypes> 
  10.                 <SnippetType>Expansion</SnippetType> 
  11.             </SnippetTypes> 
  12.         </Header> 
  13.         <Snippet> 
  14.             <Code Language="PowerShell" Kind="5"><![CDATA[function prompt { 
  15.     Write-Prompt ((Get-History -Count 1).Id + 1) 
  16.     $Host.UI.RawUI.WindowTitle = get-location 
  17.  
  18.     return ' ' 
  19. }]]></Code> 
  20.         </Snippet> 
  21.     </CodeSnippet> 
  22. </CodeSnippets> 
Filed under: ,

Replaces the prompt with the current command history id and displays the current path in the console title bar

Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.