Set-Location scope
cd, powershell, scope
Solution
try
{
Push-Location
Set-Location c:\
# your code here ...
}
finally
{
Pop-Location
}
Problem
Given this file ``` Set-Location C:\ ``` If I run it ``` .\foo.ps1 ``` It will change the directory in the script. However once the script is finished the parent console directory has also been changed. Can `Set-Location` be called in such a way as to affect only the running script?