title: How to reload user profile from script file in PowerShell
body: <p>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:</p>
  
  <pre><code># file.ps1
  . $PROFILE</code></pre>
  
  <p>However, it does work if I dot source it from PowerShell's interpreter.</p>
  
  <p><strong>Why do I want to do this?</strong></p>
  
  <p>I run this script every time I update my profile and want to test it, so I'd like to avoid having to restart PowerShell to refresh the environment.</p>