Location, location
The location cmdlets don’t seem to get used very much from the scripts I have seen. There are four cmdlets dealing with location:
Get-Location
Pop-Location
Push-Location
Set-Location
In its simplest use Get-Location supplies the path to the current folder
PS> Get-Location
Path
----
C:\scripts
Set-Location can be used to change folders. It is aliased to
cd
chdir
sl
PS> Set-Location -Path dns
PS> Get-Location
Path
----
C:\scripts\dns
Push and pop are a bit more interesting
Push-location can be used to store the current location and jump to another location
PS> Push-Location -Path hklm:\software
PS> Get-Location
Path
----
HKLM:\software
Pop-location can be used to return us to our starting point
PS> Pop-Location
PS> Get-Location
Path
----
C:\scripts\dns
thats the basics covered but there is a bit more we do with locations as we will see