Created
January 23, 2025 15:04
-
-
Save JohnL4/a8002cc16f8f0c8a5d79bbfdddfd8c3b to your computer and use it in GitHub Desktop.
Figure out the path to the currently-executing PowerShell script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Figure out the path to the currently-executing script so we can do stuff like dot-source other PS snippets or invoke other scripts | |
in the same directory. | |
.NOTES | |
Can use one of: | |
- $MyInvocation -- Looks like this is really NOT the way to go. Seems a bit complicated to get the right info out of here. | |
Could be useful for a variety of info, but not the path to the current script. | |
- $PSCommandPath | |
- $PSScriptRoot | |
#> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment