Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 1.0 » Push-Location

Push-Location - Powershell 1.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »

Push-Location

Description
Push a location to the stack

Usage
Push-Location { [[-path] string] | [-literalPath string] }
            [-stackName string] [-passThru] [CommonParameters]

Options
-path string
       Change your location to string after first pushing the 
       current location onto the stack. Wildcards are permitted.

   -literalPath string
       Like -Path above, only the value is used exactly as typed.
       No characters are interpreted as wildcards. If the path includes any
       escape characters then enclose the path in single quotation marks. 

   -stackName string
       An alternate stack. This stack now becomes the current stack.

   -passThru 
       Pass the object created through the pipeline. 
       By default, Pop-Location does not pass any objects through the pipeline.
		
   CommonParameters:
       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutVariable.

Example(s)
Push the current location onto the default stack and then change location to C:\Windows\ :

PS C:\>push-location C:\Windows

Push the current location onto the stack and then change to the home directory (%USERPROFILE%), which can be represented by the tilde symbol (~) or $home:

PS C:\>push-location ~

Push the current location onto the 'myregstack' stack and change location to HKLM:\Software\Policies:

PS HKLM:\software>push-location HKLM:\Software\Policies -stackname myRegstack