$profile
is the file name of a PowerShell profile for the current user and the current host application. This profile is executed automatically when PowerShell is started (unless PowerShell is invoked with the command line option -noProfile
). $profile
seems to be a string: PS C:\Users\Rene> $profile.getType().fullName System.String
$profile
is not a exactly a string as this variable actually stores four profile locations by means of the Extended Type System: PS C:\Users\Rene> write-output $profile C:\Users\Rene\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 PS C:\Users\Rene> write-output $profile.currentUserCurrentHost C:\Users\Rene\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 PS C:\Users\Rene> write-output $profile.currentUserAllHosts C:\Users\Rene\Documents\WindowsPowerShell\profile.ps1 PS C:\Users\Rene> write-output $profile.allUsersCurrentHost C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.PowerShell_profile.ps1 PS C:\Users\Rene> write-output $profile.allUsersAllHosts C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1
host
. $profile
«object» into format-list
with the -force
option or by explicitly asking for the psExtended
member: C:\> $profile | format-list -force C:\> $profile.psExtended
WindowsPowerShell
is replaced with simply PowerShell
, for example C:\Users\Rene\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
$profile
in Linux are: /home/<username>/.config/powershell/Microsoft.PowerShell_profile.ps1
/home/<username>/.config/powershell/profile.ps1
/opt/microsoft/powershell/7/Microsoft.PowerShell_profile.ps1
/opt/microsoft/powershell/7/profile.ps1
powershell.exe -noProfile
. -noLogo
and the execution of the profile script takes longer than a certain amount of time (I believe this threshold to be 500 ms), PowerShell will also display the message Loading personal and system profiles took xyz ms.. profile.ps1
script. $psDefaultParameterValues
automatic variable.