15 lines
329 B
PowerShell
15 lines
329 B
PowerShell
[System.Collections.ArrayList]$Locations = @()
|
|
|
|
function Change-Location($path) {
|
|
$loc = Get-Location
|
|
$Locations.Add($loc) | Out-Null
|
|
Set-Location $path | Out-Null
|
|
}
|
|
|
|
function Restore-Location {
|
|
$idx = $Locations.Count - 1
|
|
$loc = $Locations[$idx]
|
|
$Locations.RemoveAt($idx) | Out-Null
|
|
Set-Location $loc | Out-Null
|
|
}
|