Set the current working location.
Syntax
Set-Location [[-path] string] [-passThru] [CommonParameters]
Set-Location [-literalPath] string] [-passThru] [CommonParameters]
Set-Location [-stackName string] [-passThru] [CommonParameters]
Key
-path string
The path to a new working location.
-literalPath string
Like Path above, only the value is used exactly as typed.
No characters are interpreted as wildcards. If the path includes any
escape characters then enclose the path in single quotation marks.
-stackName
The stack to which the location is being set.
-passThru
Pass the object created by this cmdlet through the pipeline.
CommonParameters:
-Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutVariable.
Examples
Set the current location to HKLM in the registry provider:
PS C:\>set-location HKLM:
Set the current location to the environment variable provider:
PS C:\>set-location env: -passthru
Set the current location to the C:\ drive in the FileSystem provider:
PS C:\>set-location C:
“The three most important factors in buying a home are, location, location, location!”
Related:
Get-Location - Get and display the current location
Pop-Location - Set the current working location (from the stack)
Push-Location - Push a location to the stack
Equivalent bash command: cd - Change Directory