When to use Push-Location versus Set-Location?
They will both change the working directory but using Push-Location
will add the current working directory to the top of a stack before changing to the new working directory. You can then use Pop-Location
to traverse back down the stack through the previous working directories.
Set-Location
will just change the working directory in the same way that cd
would.
Set-Location = cdPush-Location = pushdPop-Location = popd