Pop-Location

 

SYNOPSIS

Changes the current location to the location most recently pushed onto the stack. You can pop the location from the default stack or from a stack that you create by using Push-Location.

 

SYNTAX

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

 

DETAILED DESCRIPTION

The Pop-Location cmdlet changes to the location most recently pushed onto the stack by using Push-Location. You can pop a location from the default stack or from a stack that you create by using Push-Location.

 

PARAMETERS

 

-stackName <string>

Specifies an alternate stack. Pop-Location pops the most recently added location from this stack. This stack now becomes the current stack.

 

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

 

<CommonParameters>

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

 

INPUT TYPE

String

 

RETURN TYPE

PathInfo Object (When -passthru is used)

 

NOTES

 

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

 

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

 

You can also refer to Pop-Location by its built-in alias, "popd". For more information, see About_Alias.

 

EXAMPLE 1

 

pop-location

 

This command changes your location to the location most recently added to the current stack.

 

EXAMPLE 2

 

pop-location -stackname Stack2

 

This command changes your location to the location most recently added to the Stack2 stack.

 

EXAMPLE 3

 

pushd HKLM:\Software\Microsoft\PowerShell

pushd Cert:\LocalMachine\TrustedPublisher

popd

popd

 

These commands use the Push-Locationand Pop-Location cmdlets to move between locations supported by different Windows PowerShell providers. The commands use the "pushd" alias for Push-Location and the "popd" alias for Pop-Location.

 

The first command pushes the current file system location onto the stack and moves to the HKLM drive supported by the Windows PowerShell Registry provider. The second command pushes the registry location onto the stack and moves to a location supported by the Windows PowerShell certificate provider.

 

The last two commands pop those locations off of the stack. The first "Popd" returns to the Registry drive and the second returns to the file system drive.

 

push-location HKLM:\Software\Microsoft\PowerShell

HKLM:\Software\Microsoft\PowerShell> push-location Cert:\LocalMachine\TrustedPublisher

cert:\LocalMachine\TrustedPublisher> popd

HKLM:\Software\Microsoft\PowerShell> popd

C:\ps-test>

 

RELATED LINKS

Push-Location

Set-Location

Get-Location