Set-Location

 

Additional Resources for Set-Location

 

Navigating through Windows PowerShell Namespaces

http://www.microsoft.com/technet/scriptcenter/topics/msh/cmdlets/set-location.mspx

 

 

SYNOPSIS

Sets the current working location to a specified location.

 

SYNTAX

Set-Location [[-path] <string>] [-passThru] [<CommonParameters>]

 

Set-Location [-stackName <string>] [-passThru] [<CommonParameters>]

 

Set-Location [-literalPath] <string> [-passThru] [<CommonParameters>]

 

DETAILED 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 another location stack.

 

PARAMETERS

 

-path <string>

This parameter is used to specify the path to a new working location.

 

Required?

false

Position?

1

Default value

String.empty

Accept pipeline input?  

true (ByValue, ByPropertyName)

Accept wildcard characters? 

true

 

-stackName <string>

The name of the stack to which the location is being set.

 

Required?

false

Position?

named

Default value

<NOTE: if not specified uses the current working stack>

Accept pipeline input?  

true (ByPropertyName)

Accept wildcard characters? 

false

 

-passThru <SwitchParameter>

Passes the object created by this cmdlet through the pipeline. By default, this cmdlet does not pass any objects through the pipeline.

 

Required?

false

Position?

named

Default value

False

Accept pipeline input?  

false

Accept wildcard characters? 

false

 

-literalPath <string>

Specifies a path to the location. The value of -LiteralPath is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences.

 

Required?

true

Position?

1

Default value

 

Accept pipeline input?  

true (ByPropertyName)

Accept wildcard characters? 

false

 

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, and -OutVariable. For more information, type, "get-help about_commonparameters".

 

INPUT TYPE

String

 

NOTES

 

For more information, type "Get-Help Set-Location  -detailed". For technical information, type "Get-Help Set-Location -full".

 

When specifying multiple values for a parameter, use commas to separate the values. For example, "<parameter-name> <value1>, <value2>".

 

EXAMPLE 1

 

set-location HKLM:

 

This will set the current location to the one specified, in this case it is the HKLM provider.

 

EXAMPLE 2

 

set-location env: -passthru

 

This will set the current location to the one specified, in this case it is the environment variable provider.

 

Path

----

Env:\

 

EXAMPLE 3

 

set-location C:

 

This will set the current location to the one specified, in this case it is the C: drive in the file system provider.

 

RELATED LINKS

Get-Location

Pop-Location

Push-Location