- open powershell(or pwsh) as administrator
- check if file exists with this command:
Test-Path $profile
or try to directly open it with this one:notepad $PROFILE
- if error occurs run this command to add one
New-Item -ItemType File -Path $profile -Force
- open the profile file:
notepad $PROFILE
- open powershell(or pwsh) as admin and the profile file:
notepad $PROFILE
- add this to the bottom:
function QuitReplacement{
Invoke-command -ScriptBlock {exit}
}
New-Alias -Name q -Value QuitReplacement
- Open powershell(or pwsh) as administrator and install posh-git:
Install-Module posh-git -Scope CurrentUser
- open the profile file:
notepad $PROFILE
and add this for it to work every session:Import-Module posh-git
- If you have any errors about exceution policies, allow them like this
Run this:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
Links:
- https://www.rodyvansambeek.com/blog/git-autocomplete-powershell-magic
- https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_aliases?view=powershell-7.4
- https://www.reddit.com/r/PowerShell/comments/7751dz/comment/dokf789/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button
- https://learn.microsoft.com/powershell/module/microsoft.powershell.security/set-executionpolicy