HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

Set-Location — Display the current working directory or move to a different directory. Note: This command can only

Submitted by: @import:tldr-pages··
0
Viewed 0 times
thecurrentdirectorycommandcliworkingset-locationdisplay
windows

Problem

How to use the Set-Location command: Display the current working directory or move to a different directory. Note: This command can only be used through PowerShell. More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.management/set-location>.

Solution

Set-Location — Display the current working directory or move to a different directory. Note: This command can only be used through PowerShell. More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.management/set-location>.

Go to the specified directory:
Set-Location {{path\to\directory}}


Go to a specific directory in a different drive:
Set-Location {{C}}:{{path\to\directory}}


Go and display the location of specified directory:
Set-Location {{path\to\directory}} -PassThru


Go up to the parent of the current directory:
Set-Location ..


Go to the home directory of the current user:
Set-Location ~


Go back/forward to the previously chosen directory:
Set-Location {{-|+}}


Go to root of current drive:
Set-Location \

Code Snippets

Go to the specified directory

Set-Location {{path\to\directory}}

Go to a specific directory in a different drive

Set-Location {{C}}:{{path\to\directory}}

Go and display the location of specified directory

Set-Location {{path\to\directory}} -PassThru

Go up to the parent of the current directory

Set-Location ..

Go to the home directory of the current user

Set-Location ~

Context

tldr-pages: windows/Set-Location

Revisions (0)

No revisions yet.