The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

PathIntrinsics.PopLocation Method (String)


Updated: April 27, 2016

Applies To: Windows PowerShell

Pops off the top location from the specified location stack or the default location stack.

Namespace:   System.Management.Automation
Assembly:  System.Management.Automation (in System.Management.Automation.dll)

public PathInfo PopLocation(
	string stackName


Type: System.String

The name (identifier) of the specified location stack. If null, the default location stack is used.

Return Value

Type: System.Management.Automation.PathInfo

A PathInfo object that represents the location (the latest location) that was at the top of the location stack.

Exception Condition

The path on the stack does not exist, is not a container, or can be resolved to multiple containers. This exception type is thrown when the stack name contains wildcard characters that resolve to multiple location stacks or when the stack cannot be found.


The provider that is associated with the retrieved path does not exist.


The drive that is associated with the retrieved path does not exist.


The provider that is associated with the retrieved path throws an exception.

If no stack name is specified, the last location is popped off the default location stack. To set the default location stack, see the SetDefaultLocationStack method.

To add the current location to the location stack, see the PushCurrentLocation method.

To retrieve the complete location stack, see the LocationStack method.

Return to top

Community Additions