Get-Location

 

Additional Resources for Get-Location

 

Checking Your Location in a Windows PowerShell Namespace

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

 

 

SYNOPSIS

Gets information about the current working location.

 

SYNTAX

Get-Location [-psProvider <string[]>] [-psDrive <string[]>] [<CommonParameters>]

 

Get-Location [-stack] [-stackName <string[]>] [<CommonParameters>]

 

DETAILED DESCRIPTION

Gets information about the current working location.

 

PARAMETERS

 

-psProvider <string[]>

Outputs a PathInfo object representing the current working location for the specified providers.

 

Required?

false

Position?

named

Default value

current working provider

Accept pipeline input?  

true (ByPropertyName)

Accept wildcard characters? 

true

 

-psDrive <string[]>

Outputs a PathInfo object representing the current working location for the specified drives.

 

Required?

false

Position?

named

Default value

 

Accept pipeline input?  

true (ByPropertyName)

Accept wildcard characters? 

true

 

-stack <SwitchParameter>

Outputs a StackInfo object representing the current stack.

 

Required?

false

Position?

named

Default value

False

Accept pipeline input?  

false

Accept wildcard characters? 

false

 

-stackName <string[]>

Outputs StackInfo objects representing the specified stacks.

 

Required?

false

Position?

named

Default value

 

Accept pipeline input?  

true (ByPropertyName)

Accept wildcard characters? 

true

 

<CommonParameters>

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

 

RETURN TYPE

PathInfo Objects or StackInfo Objects

 

NOTES

 

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

 

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

 

Locations can be stored on a stack and pop will access the last location on top of the stack. Push will add a location to the top of the stack.

 

The PSProvider, PSDrive, Stack and Stackname parameters interact in ways that depend upon the provider.  Some combinations will result in errors, such as specifying both a drive and a provider that does not provide that drive. If no parameters are specified then get-location will return the PathInfo Object for the provider that contains the current working location.

 

EXAMPLE 1

 

get-location

 

This command displays the current working location.

 

EXAMPLE 2

 

get-location -stack

 

This command displays the items on the current stack. The current location is not displayed. To display the current location, run the command without the Stack parameter.

 

RELATED LINKS

Pop-Location

Push-Location

Set-Location