I am trying to add a new line before each Powershell prompt to improve readability as shown below.
Instead of:
(base) PS C:\Users\myname --> "Hello"
Hello
(base) PS C:\Users\myname --> "Wow"
Wow
I would like an output like this:
(base) PS C:\Users\myname --> "Hello"
Hello
(base) PS C:\Users\myname --> "Wow"
Wow
(base) PS C:\Users\myname -->
My powershell profile, which I have modified for my prompt and to add the conda environment hook as per other SO posts is as follows:
function Prompt
{
$promptString = "PS " + $(Get-Location) + " -->"
Write-Host "$promptString" -NoNewline -ForegroundColor Yellow
return " "
}
%{& "C:\Users\myname\Anaconda3\Scripts\conda.exe" "shell.powershell" "hook"} | Out-String | Invoke-Expression
I have tried adding the new line parameter ("`n") to the function prompt as follows:
$promptString = "`nPS " + $(Get-Location) + " -->"
This gives me the output as:
(base)
PS C:\Users\myname -->
which is not what I want.
I also tried adding a Write-Host before the conda hook but that doesn't work either:
Write-Host `n | %{& "C:\Users\myname\Anaconda3\Scripts\conda.exe" "shell.powershell" "hook"} | Out-String | Invoke-Expression
It gives me the error: "Invoke-Expression : Cannot bind argument to parameter 'Command' because it is an empty string." So this doesn't work either.
I assume this should be a simple fix but I'm unable to find the right commands/place to put the command that will allow me to add that new line to improve readability of the code. Been googling for a while and though I've learned quite a bit doing so, just haven't been able to find a fix for quite some time, so looking to the Stack Overflow community for some help. Thank you in advance!