Get Script Dir
Last Modified: February 25, 2024 18:18 CEST

Get-ScriptDir #

SYNOPSIS #

Returns the path to the script that will be executed

SYNTAX #

Get-ScriptDir [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION #

If the path cannot be determined, an attempt is made to obtain the path via the $PSScriptRoot runtime variable. If this also fails, the current directory is returned.

EXAMPLES #

Example 1:Returns the path of the script #

PS C:\> Get-ScriptDir

Returns the path of the calling script.

PARAMETERS #

CommonParameters #

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS #

None #

OUTPUTS #

System.Object #

NOTES #