# make sure own profile's PATH
PS C:\Users\Administrator> Write-Output $profile
C:\Users\Administrator\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
PS C:\Users\Administrator> Get-Item $profile
# none by default
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:1 char:10
+ Get-Item $profle
+ ~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.GetItemComm
and
# create it
PS C:\Users\Administrator> New-Item $profile -type file -force
Directory: C:\Users\Administrator\Documents\WindowsPowerShell
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2019/02/21 15:15 0 Microsoft.PowerShell_profile.ps1
# for example, set command that shows messages [This is from $profile]
PS C:\Users\Administrator> Write-Output 'Write-Output "This is from $profile"' > $profile
PS C:\Users\Administrator> exit
# run PowerShell
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
# message is displayed
This is from C:\Users\Administrator\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
PS C:\Users\Administrator>
|