The cd command changes your current directory in PowerShell
To change directories in PowerShell, type cd followed by a space and the path where you want to go. For example, cd C:\Users\YourName\Documents moves you into your Documents folder. PowerShell then shows your new location in the prompt, usually at the start of the next line.
PowerShell uses the same cd command as older command-line tools, but it also accepts the newer Set-Location command, which does the same thing. Most people use cd because it is shorter to type.
Key Takeaways
- Type cd followed by a space and a folder path to move into that directory.
- Use backslashes to separate folder names in a path, like cd C:\Users\YourName\Desktop.
- Type cd .. to move up one level to the parent directory.
- Type pwd to see your current directory if you lose track of where you are.
- Paths with spaces need quotes around them, like cd "C:\Program Files\MyApp".
Basic syntax: what to type and where
Open PowerShell and look at the prompt. It usually shows something like PS C:\Users\YourName>. The part after PS is your current location. To move to a different folder, type cd, then a space, then the full path to where you want to go.
For example, if you want to go to your Downloads folder, type:
cd C:\Users\YourName\Downloads
Press Enter. PowerShell moves you there and updates the prompt to show PS C:\Users\YourName\Downloads>. You are now in that directory and can list files, run programs, or navigate further.
Navigating with relative paths instead of full paths
You do not have to type the entire path every time. If you are already in C:\Users\YourName and want to go into the Documents folder inside it, you can type just cd Documents instead of the full path. PowerShell assumes you mean a folder inside your current location.
To move up one level to the parent directory, type cd .. (that is two periods). If you are in C:\Users\YourName\Documents, typing cd .. takes you back to C:\Users\YourName. You can chain them together too: cd ..\..\ moves up two levels.
To jump to a completely different drive, like from C: to D:, type cd D:\. PowerShell switches to that drive and shows its root directory.
Handling folder names with spaces
If a folder name contains spaces, you must wrap the path in double quotes. For example, Program Files has a space in it, so to navigate there you would type:
cd "C:\Program Files"
Without the quotes, PowerShell reads the space as the end of the command and tries to interpret Files as a separate instruction, which causes an error. The same rule applies to any folder with spaces: cd "C:\Users\YourName\My Documents" or cd "C:\Users\YourName\Desktop\My Project".
Checking where you are with pwd
If you have navigated through several directories and lose track of your current location, type pwd (short for "print working directory"). PowerShell displays the full path of the directory you are in right now.
You can also just look at the prompt itself — it always shows your current directory. But pwd is useful if the prompt is hard to read or if you want to copy the full path to use somewhere else.
Listing files in your current directory
Once you have changed to a directory, you often want to see what is inside it. Type ls or dir to list all files and folders in your current location. Both commands work in PowerShell and show the same information: file names, sizes, and the date they were last modified.
If you want to see files in a different directory without changing to it first, type ls C:\Users\YourName\Downloads. PowerShell lists the contents of that folder without moving you there.
Using Tab to complete directory names automatically
PowerShell has a built-in shortcut to save typing. Start typing a directory name and press Tab. PowerShell automatically fills in the rest of the name if it can find a match. For example, if you type cd Doc and press Tab, PowerShell completes it to cd Documents (assuming a Documents folder exists in your current location).
If multiple folders start with the same letters, pressing Tab cycles through them one at a time. This is especially useful for long paths or folder names with spaces — PowerShell adds the quotes automatically.
Frequently Asked Questions
What is the difference between cd and Set-Location?
They do the same thing. cd is an alias (a shortcut name) for the Set-Location command. PowerShell accepts both, but cd is faster to type and works the same way in practice.
Why do I get an error when I type a path with spaces?
PowerShell treats spaces as separators between commands. If you type cd C:\Program Files without quotes, PowerShell reads it as two separate things and fails. Wrap the path in double quotes: cd "C:\Program Files".
Can I go back to the directory I was just in?
PowerShell does not have a built-in "back" button like a file browser, but you can type cd - to return to your previous directory. This works only once — it takes you back to the last place you were, not to a full history.
How do I navigate to a folder on a different computer or network drive?
If the network drive is mapped to a letter (like Z:), use cd Z:\ just as you would a local drive. If it is not mapped, type the full network path in quotes: cd "\\ComputerName\ShareName".