Last updated: Apr 4, 2024
Reading time·4 min
The Windows cd
command is the equivalent of the Unix pwd
command. When the
cd
command is used without specifying any parameters, it displays the current
drive and directory.
Click on the Search bar, type "cmd" and open the Command Prompt.
cd
The cd command is used to display the name of the current directory or change the current directory.
cd
command without providing any parameters, it displays the current drive and directory.You can look at other examples of using the cd
command in
this section
of the docs.
For example, the cd\
command can be used to return to the root directory.
cd\
If you need to change to a directory that contains spaces in its name, enclose the path in double quotes.
cd "Documents and Settings"
cd
command.To open CMD as an administrator:
Click on the Search bar and type CMD.
Right-click on the Command Prompt application and click "Run as administrator".
cd
command to display the current directory
and change to any directory.An alternative to consider is to use PowerShell where the pwd
command is
available
pwd
command on Windows in PowerShellTo use the pwd
command on Windows in PowerShell:
Use the pwd
command directly in PowerShell to display the current drive and
directory.
pwd
If you need to open PowerShell in a specific folder:
Shift
and right-click in Explorer.pwd
command.The pwd
command in PowerShell is an alias for the
Get-Location
command.
Get-Location
If you get a permissions error, you have to run PowerShell as an administrator.
To run PowerShell as an administrator:
pwd
command to display the current
directory.pwd
command in Git Bash by installing git
on your Windows machine.If you already have git
installed, you can search for Git Bash
and use the
pwd
command, otherwise, you have to install git
first.
pwd
command on Windows in Git BashTo download git
and be able to use Git Bash:
Next
.Next
.Click Next
on the screen that prompts you to "Select Start Menu Folder".
On the next screen, you can choose the default editor for Git
, e.g.
Notepad
, Notepad++
or any other editor you prefer.
Next
.Next
.Install
button to install git
.Once you have git
installed, click on the Search field, type "Git Bash"
and start the application.
Now you can use the pwd
command directly in Git Bash.
pwd
If you need to open Git Bash in a specific folder:
Now you can use the pwd
command to display the current drive and directory.
pwd
You can learn more about the related topics by checking out the following tutorials: