M BUZZ CRAZE NEWS
// general

Cannot cd to a folder with spaces in the the folder path

By Daniel Rodriguez

I am trying to cd to the Program Files directory, but I'm getting an error. Here is the screen shot.

PowerShell Error Message

Here's the command I'm running and the error message:

PS C:\> cd C:\Program Files

Set-Location : A parameter cannot be found that matches parameter name 'Files'. At line:1 char:3 + cd <<<< C:\Program Files

2

7 Answers

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.

You need to surround the path in double quotes if there is a space in the path!

cd "C:\Program Files"

You can also use the ProgramFiles environment variable

cd $env:ProgramFiles

Try this

C:\>cd "Program Files"

This will work.

METHOD1: With Quotes

cd "C:/Prgram Files (x86)"

cd 'C:/Program Files (x86)'

Method2: Without using Quotes

cd Program\ Files \(x86\)

Similarly it will go for Program Files.

Try then 8.3 filename version:

cd C:\Progra~1

Also try:

cd C:\Program*

You should try with

cd C:\Program\ Files
2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy