How to reload user profile from script file in PowerShell

后端 未结 8 587
情深已故
情深已故 2020-12-29 01:02

I want to reload my user profile from a script file. I thought that dot sourcing it from within the script file would do the trick, but it doesn\'t work:

# f         


        
8条回答
  •  抹茶落季
    2020-12-29 01:52

    Why are you trying to do this?

    Because it is likely to create duplicates (appends to $env:path) and problems with setting constant/readonly objects causing errors.

    There was a thread on this topic recently on microsoft.public.windows.powershell.

    If you are trying to reset the state of the session there is no way to do this, even using an inner scope ($host.EnterNestedPrompt()) because of the ability to set variables/aliases/... at "all scope".

提交回复
热议问题