Question

I'd like to get my prompt in powershell to be at the bottom instead of "from top to bottom".

There is a workaround for cmd (https://superuser.com/questions/644326/start-conemu-with-prompt-at-the-bottom) but I can't find a way to make it work in powershell.

Does anyone have an idea?

Thanks a lot!

Was it helpful?

Solution 2

I'm not sure this is what you want, but this works fairly well for me. Save this as a .ps1 file somewhere that makes sense or convert it into a cmdlet if you like. Then stick it in your profile so it runs when you open a powershell session:

cls
$Ui = (Get-Host).UI.RawUI
$Height = $UI.WindowSize.Height
$Coordinates = New-Object System.Management.Automation.Host.Coordinates 0,($Height - 1)
$Ui.CursorPosition = $Coordinates

Create an alias for it.

 New-Alias -Name cl -Value \\Path_to_the_script_or_the_cmdlet

Use the alias to clear your screen rather than clear or cls.

OTHER TIPS

Thought, more "clean" version of prompt function. No need of New-Object ... Just add/modify your prompt in the $profile.

function prompt {
  # put cursor at the bottom of the buffer
  $rawUI = (Get-Host).UI.RawUI
  $cp = $rawUI.CursorPosition
  $cp.Y = $rawUI.BufferSize.Height - 1
  $rawUI.CursorPosition = $cp

  # and the prompt itself
  Write-Host -NoNewline -ForegroundColor Cyan "PS "
  Write-Host -NoNewline -ForegroundColor Yellow $(get-location).ProviderPath
  return ">"
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top