Change Directory in PowerShell: Paths, Spaces, and Drives

PowerShell changes directory with cd, which is a short name for Set-Location. Type cd 'C:\Program Files' to enter that folder, or replace the quoted path with the folder you need.

Quotes stop spaces from splitting the path into separate arguments. A different drive doesn't need a separate command: cd 'D:\Projects' changes both the active drive and folder, provided the folder exists.

Start with the folder's full path

Open Windows PowerShell, or choose PowerShell from the tab menu in Windows Terminal. Check the tab name before pasting commands: Terminal also hosts other shells, including Command Prompt. A normal PowerShell prompt usually starts with PS.

  1. Find your destination folder in File Explorer.
  2. Copy its full path from the address bar.
  3. Type Set-Location -LiteralPath , add the path inside single quotes, and press Enter.
  4. Run Get-Location to check the new location.

For example, this enters the Windows folder without changing any files:

Set-Location -LiteralPath 'C:\Windows'
Get-Location
Drawing of PowerShell with Set-Location and Get-Location commands

Get-Location should show the path you requested. Set-Location normally finishes without a success message. If the prompt now shows your destination, the command worked even though it didn't print anything.

Microsoft's Set-Location reference describes both the regular path and literal-path forms. I'd use the literal form when pasting an unfamiliar folder name, especially one containing square brackets.

Changing directory sets the folder that later commands in that session work from. It doesn't move, rename, or open the folder in Explorer. Check the location before running a command that changes files using a relative path.

Use cd for everyday navigation

Once you know the path, cd saves some typing. These examples use folders normally present in Windows:

cd 'C:\Windows'
cd 'C:\Program Files'

Quotes are necessary when spaces would otherwise split the path into separate pieces. They also make longer commands easier to read. Use straight quotation marks when typing a command copied from formatted text.

To enter a folder inside your current location, type its name rather than the whole path. From C:\Windows, cd System32 enters C:\Windows\System32. That same short command won't reach System32 from an unrelated folder.

Use cd .. to move to the parent folder. From C:\Windows\System32, it takes you to C:\Windows. Running it once more reaches C:\. It means one level toward the drive's root, not the folder visited previously.

Run Get-ChildItem -Directory if you need to see the subfolders available at your current location. Choose the destination from those names, then run Get-Location if the prompt doesn't make the result clear.

Tab completion can save typing: enter the beginning of a folder name and press Tab. Check the completed text before pressing Enter. Several folders can begin with the same letters, and the first completed name can lead somewhere else.

Change drives without the Command Prompt syntax

A full drive path works directly in PowerShell:

cd 'D:\Projects'

This example only works if your computer has that drive and folder. Replace both parts with your own destination. Don't create a folder just to make a copied example stop reporting an error.

Use a backslash after the colon when you mean the drive's root, its top-level folder. D:\ points to the root of D. Without that backslash, the drive name can take you to the folder PowerShell remembers on that drive instead.

The Command Prompt instruction cd /d isn't the PowerShell way to switch drives. Use Set-Location or cd with the full destination path. Check which shell the instructions are for when switching between a cmd window and a PowerShell tab.

Network locations can use a full shared-folder path, such as Set-Location -LiteralPath '\\server\share'. Replace the server and share names with the real ones. You still need a working connection and permission to open that shared folder.

Handle brackets, missing paths, and access errors

A folder name can contain characters that ordinary -Path reads as patterns to match, called wildcards. Square brackets are a common example. -LiteralPath tells PowerShell to use the characters exactly as entered.

For a folder named Reports [Final], use Set-Location -LiteralPath 'D:\Reports [Final]', with your actual drive. Quotes keep the spaces together; the literal parameter handles the brackets. They solve different problems.

When PowerShell says it cannot find the path, open that exact location in File Explorer. Check the drive letter, spelling, and whether the folder is inside OneDrive or another parent folder you omitted.

A path ending in a file name isn't a directory. Enter the containing folder first. Giving Set-Location a script or document path won't open that file.

For an access-denied error, check whether your account can open the folder normally. On a work computer, ask the folder's owner or administrator for access instead of changing a protected directory's permissions.

Return home or revisit a recent location

Set-Location with no path returns to your user's home directory. That's useful when a command has left you in an unfamiliar folder. It doesn't mean the root of C or every folder displayed under Home in File Explorer.

PowerShell 6.2 and later also support cd - and cd + for location history. Windows PowerShell 5.1 doesn't have that newer history feature. Use a full path when following instructions that must work in both versions.

For a temporary visit, Push-Location 'C:\Windows' saves your location and changes folders. Pop-Location returns to it. Use this when checking another folder before continuing your original work.

For shell errors that changing folders won't fix, the missing SSH command checks explain executable lookup. A guide that still asks for WMIC needs a replacement command, rather than another directory change.

When the exact path works in Explorer but still fails in PowerShell, keep the command and complete error text. Give those to your administrator or the PowerShell support community, with personal folder names removed.

The Short Version

Use cd 'full path', or Set-Location -LiteralPath 'full path' for names with brackets. Check the result with Get-Location. Use a complete drive path to switch drives and cd .. to go to the parent folder.

Checked December 1, 2026.

If you have any business, I can build it online

Hi, I’m Hamza. I’ve been building websites and online shops for business owners since 2019, and I also built this site you’re reading.

Tell me what business you have or what you’re working on. I’ll look into how much it can grow online, and then we talk. You don’t have to buy anything or hire me first.

Chat with me on my site and I’ll show you proof of businesses I’ve helped and how they’ve grown.

Written by Isaac Smith

Isaac Smith is the founder and editor of PC Glance, a website that covers computers, laptops, and technology. He is a tech enthusiast and a computer geek who loves to share his insights and help his readers make smart choices when buying tech gadgets or laptops. He is always curious and updated about the latest tech trends.

More from Isaac Smith

Leave a Comment