Commands / Files

Set-Location

Change the current directory

beginner Files Aliases cdslchdir

Set-Location
 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

ShellWhat you might type
bash / zshcd docs
cmd.execd docs

More in From bash and From cmd.

Related commands