Set-Location
Change the current directory
Set-Location -Path .\docs
- Works on
- WindowsLinuxmacOS
- PowerShell
- 5.1 and later
- Reference
- Microsoft Learn: Set-Location
Changes the working directory for the rest of the session. Same idea as cd.
Set-Location .. goes up one folder. Set-Location - (PowerShell 6+) goes back.
Try this
Set-Location -Path $env:TEMP
Get-Location
Coming from another shell
| Shell | What you might type |
|---|---|
| bash / zsh | cd docs |
| cmd.exe | cd docs |
More in From bash and From cmd.