My Windows Powershell configuration with oh-my-posh and PSReadline.
⚠ You should use a modern console host like ConEmu, Alacritty, Terminus, Hyper, FluentTerminal, or the official Windows Terminal to have a great terminal experience on Windows. ⚠
- This command will show which policy is active
Get-ExecutionPolicy
Policy table
Restriced | AllSigned | RemoteSigned | Unrestriced | ByPass |
---|---|---|---|---|
No script can be run. Windows Powershell can only be used in interactive mode. | Only scripts signed by a trusted publisher can run. | Download scripts must be signed by a trusted publisher before they can be run. | No restrictions. All scripts can be run, but download scripts will prompt for permission before it runs. | All scripts can be run, without warnings or prompts. |
Example: My Powershell is using RemoteSigned policy
- This command will change your policy:
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
- Install PSReadline
Install-Module -Name PSReadLine -AllowPrerelease -Scope CurrentUser -Force -SkipPublisherCheck
- If you don't have an -AllowPrerelease flag, upgrade PowerShellGet with:
Install-Module -Name PowerShellGet -Force first.
- Install oh-my-posh
Install-Module oh-my-posh -Scope CurrentUser
(Not necessary)
- Install Get-ChildItemColor
Install-Module -Name Get-ChildItemColor -AllowPrerelease -Scope CurrentUser -Force -SkipPublisherCheck -AllowClobber
- Into your powershell, execute this command:
if (!(Test-Path -Path $PROFILE )) {
New-Item -Type File -Path $PROFILE -Force
}
# To open in visual studio code, but you can change it
code $PROFILE