PowerShell Logo Small

Set-Location



This is the built-in help made by Microsoft for the command 'Set-Location', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Sets the current working location to a specified location.

SYNTAX


Set-Location [[-Path] [<String>]] [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String>]] [-PassThru]
[<CommonParameters>]
Set-Location [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String>]] [-PassThru] -LiteralPath
<String> [<CommonParameters>]
Set-Location [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String>]] [-PassThru] [-StackName
[<String>]] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Set-Location cmdlet sets the working location to a specified location. That location could be a directory, a sub-directory, a registry location, or any provider path.


You can also use the StackName parameter of the Set-Location cmdlet to make a named location stack the current location stack. For more information about location stacks,
see the Notes.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=293912
Get-Location
Pop-Location
Push-Location
about_Providers

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

PS C:\>set-location HKLM:
PS HKLM:\>



This command sets the current location to the root of the HKLM: drive.










-------------------------- EXAMPLE 2 --------------------------

PS C:\>set-location env: -passthru

Path
----
Env:\
PS Env:\>



This command sets the current location to the root of the Env: drive. It uses the Passthru parameter to direct Windows PowerShell to return a PathInfo
(System.Management.Automation.PathInfo) object that represents the Env: location.










-------------------------- EXAMPLE 3 --------------------------

PS C:\>set-location C:



This command sets the current location C: drive in the file system provider.










-------------------------- EXAMPLE 4 --------------------------

PS C:\>set-location -stackName WSManPaths



This command makes the WSManPaths location stack the current location stack.

The location cmdlets use the current location stack unless a different location stack is specified in the command. For information about location stacks, see the Notes.