Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 3
    use $script:MyInvocation.MyCommand.Path, see source path of an executing script. You get into problems with nested callers, even with the profile script, for example I have a helper function to reload your profile (after function/variable edits) but skip all one-time init (like loading .NET assemblies). Commented May 31, 2012 at 18:32
  • 1
    Is this script idempotent? Or would you potentially be re-appending the same directory over and over each time you ran it? Commented Apr 15, 2021 at 15:26
  • @RossBrasseaux There is no checking if PATH already includes the $ProfileRoot inside before appending, so no, it's not idempotent in the current state. Commented Jul 8, 2024 at 15:54