Skip to main content

Change your prompt


If you have no idea which shell you're currently using, Oh My Posh has a utility switch that can tell that to you.

oh-my-posh get shell

Edit your PowerShell profile script, you can find its location under the $PROFILE variable in your preferred PowerShell version. For example, using notepad:

notepad $PROFILE

When the above command gives an error, make sure to create the profile first.

New-Item -Path $PROFILE -Type File -Force

Then add the following line.

oh-my-posh init pwsh | Invoke-Expression
Antivirus software

If adding an exception to your Antivirus software still blocks Oh My Posh for Windows, you can try using the below alternate line in your PowerShell profile. This is a drop-in replacement to the above call with Invoke-Expression. Tested with PowerShell 7.2.4 with Bitdefender Antivirus installed and requires NO exceptions for oh-my-posh.exe. Bitdefender blocks the calls to Invoke-Expression as malicious code and this alternate line skips the double calls:

& ([ScriptBlock]::Create((oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\jandedobbeleer.omp.json" --print) -join "`n"))

Once added, reload your profile for the changes to take effect.