Powershell Command : Set Location
It was used to set the current working directory in the powershell.
Set-Location Description :
The Set-Location cmdlet was used to set the current working directory in the powershell. That location could be a directory, a sub-directory, a registry location. This is one of the most useful command in the powershell which will be used frequently by the programmers.
Set-Location Syntax :
Parameter Set: Path Set-Location [[-Path] <String> ] [-PassThru] [-UseTransaction] [ <CommonParameters>] Parameter Set: LiteralPath Set-Location -LiteralPath <String> [-PassThru] [-UseTransaction] [ <CommonParameters>] Parameter Set: Stack Set-Location [-PassThru] [-StackName <String> ] [-UseTransaction] [ <CommonParameters>]
Set-Location Parameters :
It was used to return the objects that represents the location.
It was used to specify the path to the loaction, the caluse which we are specifying as the literalpath parameter is used exactly as it is typed.
Use to specify the path to the location.
The specified location stack is made as the current location stack.
Used for active transaction.
-Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, -OutVariable.
Set-Location Examples :
1) This command sets the location to the HKLM: drive.
PS C:> set-location HKLM: PS HKLM:>
2) This command sets the location to the Env: drive
PS C:> set-location env: -passthru Path ---- Env: PS Env:>
3) This command sets the location to the C Drive.
PS C:> set-location C: