PowerShell: Profile (init file)
What is PowerShell Profile
PowerShell profile are files PowerShell loads when starting up. It can contain your own functions, alias, or other customization.
Profile Location
- All Users, All Hosts
-
$PSHOME\Profile.ps1
- All Users, Current Host
-
$PSHOME\Microsoft.PowerShell_profile.ps1
- Current User, All Hosts
-
$Home\Documents\PowerShell\Profile.ps1
- Current user, Current Host
-
$Home\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
Just create the file, and add Function or Alias or other PowerShell code to the file.
Profile Path Variable
Profile paths are stored in the variable
$PROFILE
.
In particular, in the NoteProperty
.
To list profile paths, do
$PROFILE | Get-Member -Type NoteProperty | Format-List
Start PowerShell Without Loading Profile
pwsh -NoProfile
Show PowerShell Command-Line Options
pwsh -h
or
pwsh -?
PowerShell: Profile and Script
- PowerShell: Open File by Default App
- PowerShell: Launch App, Start Process
- PowerShell: Load a Script
- PowerShell: Eval Variable, String, ScriptBlock
- PowerShell: Profile (init file)
- PowerShell: Manage PowerShell Profiles
- PowerShell: Create a Script
- PowerShell: File Name Extension
- PowerShell: Get Current Script Path