How do I change the display control panel (current path) in the console?

The powershell window (as well as other console windows) displays the full path to the current folder.

The problem is that this path is often long and pollutes the screen.

How can I configure powershell to display (prompt) only the current folder? (Keeping integration with other modules like Posh- Git)

enter image description here

+3


source to share


1 answer


The hint is defined by a function prompt

in Powershell. But if you just want to change it for posh-git than that shouldn't be hard ... Because it's actually only one line. If you haven't changed the behavior of the module, you should find a hint for defining the file here (replace notepad with an editor):

notepad (Get-Command prompt).ScriptBlock.File

      

Original line:



Write-Host($pwd.ProviderPath) -nonewline

      

Change to:

Write-Host(Split-Path -Leaf $pwd.ProviderPath) -nonewline

      

+4


source







All Articles