Contact Info

Crumbtrail » Administration » Powershell » Powershell 2.0 » Get-Location

Get-Location - Powershell 2.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 »


Short description
Gets information about the current working location.

Get-Location [-PSDrive <string[]>] [-PSProvider <string[]>] [-UseTransaction] [<CommonParameters>]

Get-Location [-Stack] [-StackName <string[]>] [-UseTransaction] [<CommonParameters>]

The Get-Location cmdlet gets an object that represents the current directory, much like the pwd (print working dire
ctory) command. 

When you move between Windows PowerShell drives, Windows PowerShell retains your location in each drive. You can us
e Get-Location to find your location in each drive.

You can also use Get-Location to get the current directory at run time and use it in functions and scripts, such as
 in a function that displays the current directory in the Windows PowerShell prompt.

If you use the Push-Location cmdlet to add locations to a path stack, you can use the Stack parameter of Get-Locati
on to display the current stack.