Type cd c:\ . Now press the tab key (this is auto-complete, which will save you a lot of typing) repeatedly until it shows you a directory with spaces in the name. Notice how it delimits the path with apostrophes '. Use the same character when you're typing.

Edit: Make sure to use an apostrophe, not a backtick.

Answer from Andrew Morton on Stack Exchange
Discussions

SFTP cd (or lcd) powershell change to dir with space in path
WinSCP generated a useful .ps1 script to use to sftp to a server to download from a server. The issue is that I want to run the .ps1 from task manager automatically on a daily basis. The WinSCP script was using a mapped drive to cd to the folder to download the files into. More on community.spiceworks.com
🌐 community.spiceworks.com
2
5
September 13, 2022
how do i use cd to go to a directory with a space in the name?
Escape it or quote it: cd /home/Documents/key\ backup cd '/home/Documents/key backup' You can also hit tab to try and let bash complete it for you. More on reddit.com
🌐 r/linux4noobs
6
7
March 5, 2019
powershell - What do I put instead of a space when changing directory? - Stack Overflow
What do I replace the space with? More on stackoverflow.com
🌐 stackoverflow.com
April 23, 2016
Add support for cd (Set-Location) to path with spaces without requiring quotes
The issue may generate an RFC or ... Microsoft.PowerShell.Management module ... We should consider updating Set-Location to not require quotes for paths. If I fire up CMD.exe I can do this: C:\Users\hillr>cd c:\program files c:\Program Files> ... 06-26 15:56:33 1> cd c:\program files Set-Location : A positional parameter cannot be found that accepts argument 'files'. Set-Location takes only a single path. It would be nice if a user could type the path without having to ... More on github.com
🌐 github.com
3
June 27, 2018
🌐
Delft Stack
delftstack.com › "delft stack" › "howto" › "powershell howtos" › "path with spaces in powershell"
Path With Spaces in PowerShell | Delft Stack
January 30, 2023 - You can use the & operator to invoke commands by enclosing the path with spaces in double quotes " ". ... Or, you can also use the . operator to run the command using the double quotes " " in the path.
🌐
Spiceworks
community.spiceworks.com › programming & development
SFTP cd (or lcd) powershell change to dir with space in path - Programming & Development - Spiceworks Community
September 13, 2022 - The issue is that I want to run the .ps1 from task manager automatically on a daily basis. The WinSCP script was using a mapped drive to cd to the folder to download the files into. Task Manager doesn’t afford access to mapped drives unfortunately. Worst of all, the UNC has a space in it, so lcd or cd keeps giving errors like.
🌐
Cornell Computer Science
cs.cornell.edu › courses › cs1110 › 2021sp › resources › shell-windows.html
Command shell for Windows: PowerShell
If you take a folder and drag-and-drop it onto the PowerShell, it will fill the window with the absolute pathname of that folder. Therefore, to quickly move the PowerShell to a a specific folder, do the following: Type cd followed by a space.
🌐
Reddit
reddit.com › r/linux4noobs › how do i use cd to go to a directory with a space in the name?
r/linux4noobs on Reddit: how do i use cd to go to a directory with a space in the name?
March 5, 2019 -

Just starting to learn how to navigate the file system in the terminal, and I am having trouble with the fact that the majority of my files have spaces in their names (at least i think thats the problem)

So I have a foulder named "key backup" that I want to navigate to, I would type

cd /home/Documents/key backup

but then i get an error

bash: cd: too many arguments

I presume this is because there is a space, because i when i use the GUI to rename the foulder to keybackup and try

cd /home/Documents/keybackup

it works fine. Is there a way i can go to directories with spaces in their names?

Find elsewhere
🌐
YouTube
youtube.com › the computer oracle
Cannot cd to a folder with spaces in the the folder path - YouTube
--------------------------------------------------Become or hire the top 3% of the developers on Toptal https://topt.al/25cXVn-------------------------------...
Published: December 22, 2023
Views: 37
🌐
4sysops
4sysops.com › home › powershell tutoiral › powershell: location, location, location
PowerShell: Location, Location, Location – 4sysops
July 28, 2023 - PS C:\> cd "program files" PS C:\program files> cd \ PS C:\> cd 'program files' PS C:\program files> Or you can escape the space with the backtick character. ... Personally, in these situations I take advantage of tab completion.
🌐
GitHub
github.com › PowerShell › PowerShell › issues › 7190
Add support for cd (Set-Location) to path with spaces without requiring quotes · Issue #7190 · PowerShell/PowerShell
June 27, 2018 - The issue may generate an RFC or may be reclassifResolution-AnsweredThe question is answered.The question is answered.WG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management modulecmdlets in the Microsoft.PowerShell.Management module ... We should consider updating Set-Location to not require quotes for paths. If I fire up CMD.exe I can do this: C:\Users\hillr>cd c:\program files c:\Program Files> ... 06-26 15:56:33 1> cd c:\program files Set-Location : A positional parameter cannot be found that accepts argument 'files'. Set-Location takes only a single path. It would be nice if a user could type the path without having to quote the path.
Author: PowerShell
🌐
Reddit
reddit.com › r/powershell › filepath with spaces in command line
r/PowerShell on Reddit: Filepath with spaces in command line
January 21, 2022 -

So this is probably really easy, but I am a Luddite.

What I’m doing: Using a .vbs to call a power shell command line as an admin, then add a windows service using:

-command New-Service -Name “”ServiceNameHere”” -BinaryPathName “”C:\Program Files(x86)…….””

I’m running into issues with the filepath - both the spaces and the parenthesis for (x86) are causing “Invalid argument: (:) [New-Service], ParameterBindingException” and “FullyQualifiedErrorId : MissingArgument”

I don’t have these issues when I type the command into the PS console manually, only when it’s brought in from my vbs script.

🌐
Adam the Automator
adamtheautomator.com › powershell-change-directory
PowerShell Change Directory: Navigating Your File System
June 26, 2026 - This feature lets you move up a level in your file system without specifying the full path to the parent directory. 1. Run the cd command below, append a space and the .. notation, which tells PowerShell to go up one level in the directory hierarchy.
🌐
SysAdminSage
sysadminsage.com › home › blog › how to cd into a folder with spaces: simple guide
How to cd into a Folder with Spaces: Simple Guide - SysAdminSage
June 5, 2026 - You can use double quotes, but you can also use single quotes. However, the real “magic” happens with the backtick (`), which is the escape character in PowerShell. Using a backtick before a space tells PowerShell, “Hey, don’t treat this space as a break; treat it as a literal character.”
🌐
Microsoft Community Hub
techcommunity.microsoft.com › microsoft community hub › communities › products › powershell › windows powershell
How include space in file path on PS command line? | Microsoft Community Hub
September 30, 2023 - What your second example is telling PowerShell to do is look for a single file in the current working directory that has an actual filename (not a path) of 'E:\MyDocuments\!Onedrive\OneDrive - Specified Nonprofit Organization Sample Japan\Sample.pdf', which isn't a valid filename. Here's some examples of appropriate (first two commands) and inappropriate (final command) quote usage as well as a path containing spaces.
Top answer
1 of 16
77
$ cd "$DOCS"

You need to quote "$DOCS" to prevent spaces from being parsed as word separators. More often than not, variable references should be quoted.

Note that $HOME would have the same problem. The issue is coming from when the shell evaluates variable references; it's nothing to do with what variables you use or how you assign to them. It's the expansion that needs to be quoted.

$ echo $HOME
/home/my dir

This is deceptive. echo is actually echoing the two strings /home/my and dir. If you use cd or ls you'll see how it's actually working.

$ ls $HOME
ls: cannot access /home/my: No such file or directory
ls: cannot access dir: No such file or directory
$ cd $HOME
bash: cd: /home/my: No such file or directory
$ cd "$HOME"
<success!>

Can I ask why it works when I manually type it in but not in a variable?

Great question! Let's examine the commands you typed:

$ DOCS="\"/cygdrive/c/Users/my dir/Documents\""
$ echo $DOCS
"/cygdrive/c/Users/my dir/Documents"
$ cd $DOCS
-bash: cd: "/cygdrive/c/Users/my: No such file or directory

The reason this doesn't work is because Bash doesn't parse quotes inside variable expansions. It does perform word splitting, so whitespace in unquoted variable expansions is taken as word separators. It doesn't parse quotes in any way, meaning you can't put double quotes inside a variable to override word splitting.

$ cd $DOCS

Because of this, cd is passed two parameters. As far as cd knows it looks like you wrote:

$ cd '"/cygdrive/c/Users/my' 'dir/Documents"'

Two parameters, with double quotes intact.

2 of 16
68

SOLUTION:

cd "Documents and Photos"

problem solved.

The reason I'm submitting this answer is you'll find that StackOverflow is being used by every day users (not just web devs, programmers or power users) and this was the number one result for a simple Windows user question on Google.

People are becoming more tech-savvy, but aren't necessarily familiar with command line in the cases above.

🌐
Petri
petri.com › home › powershell › navigating the file system with powershell: a step-by-step guide to changing directories
PowerShell Change Directory - A Quick Guide | Petri
May 21, 2025 - To change directories in PowerShell, use the Set-Location cmdlet or its alias cd or chdir. Here’s a basic example: ... PowerShell accepts both relative and absolute paths. If your path contains spaces, wrap it in quotes.
🌐
Reddit
reddit.com › r/powershell › powershell execution fails due to space in directory name
r/PowerShell on Reddit: PowerShell execution fails due to space in directory name
September 2, 2018 -

Greeting's, (Please pardon me if this is too naive question, programming / forte isn't my forte.)

I have been handed a PowerShell script that executes to install an executable which is placed in the same directory. This is packaged into SCCM (System Center Configuration Manager) for deployment. However, the deployment fails if during package deployment the temporary director where the package is pushed has a space anywhere in the file path.

I've pasted the code here - https://pastebin.com/6KBqxgNG

For example:

  1. C:\temp\deployment -- This will pass and the software will install.

  2. C:\temp\deployment 1\** -- This will **fail due to space between deployment and 1

  3. C:\temporary directory\deployment\ --** This will fai**l due to space between temporary and directory.

*Removed code due to formatting issues. Please refer to pastebin link for the code.*​

I suspect following two lines to be the cause of the problem:

​

$tempFile = [System.IO.Path]::GetTempFileName() + ".cmd"

\$installLine = "$scriptPath\softwarename.exe /s /v"/qn\\```

​

I suspect that since execution will require exact path and a "space" in the directory path will lead to "path not found" (interestingly on my Windows 10 machine change directory [cd] command works without putting filepath with spaces in quotes - "" -- This leads me to believe I'm completely wrong, however at this point I have no other thing to look at).

Can anyone please assist on adding parameters to ensure that patch generated for .cmd file to be executed does not have a space?

I have tried to patch this by adding a batch file that copies the package to a static directory before execution. However, this is failing to deploy via SCCM.

I'd greatly appreciate