powershell – When to use Push-Location versus Set-Location?

powershell – 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 = cd
Push-Location = pushd
Pop-Location = popd

powershell – When to use Push-Location versus Set-Location?

Leave a Reply

Your email address will not be published.