Is it possible to change the default value of $profile to a new value?

前端 未结 8 1521
予麋鹿
予麋鹿 2020-12-10 01:18

So I would rather not create my profile file here:

C:\\Users\\fmerrow\\Documents\\WindowsPowerShell\\Microsoft.PowerShell_profile.ps1

I mea

8条回答
  •  离开以前
    2020-12-10 01:39

    The only thing I can think of is "dot sourcing" your profile at the powershell invocation.

    For example:

    powershell -noprofile -noexit -command "invoke-expression '. ''C:\My profile location\profile.ps1''' "
    

    By changing the script that invoke-expression command points to you can place your "profile" anywhere you'd like. Then, create shortcut that launches PowerShell and set the target to the above command.

提交回复
热议问题