Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question

migrated from stackoverflow.com Sep 23 '12 at 18:52

This question came from our site for professional and enthusiast programmers.

1  
there's whitespace, escape it. –  Prinzhorn Sep 23 '12 at 17:20
4  
cd "C:\Program Files" –  Joachim Isaksson Sep 23 '12 at 17:21
add comment

5 Answers 5

up vote 4 down vote accepted

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 backticks. Use the same character when you're typing. On my en-GB keyboard it is the character to the left of the 1 key.

Edit: ugh! my eyes! It's an apostrophe, not a backtick.

share|improve this answer
add comment

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

cd "C:\Program Files"
share|improve this answer
add comment

You can also use the ProgramFiles environment variable

cd $env:ProgramFiles
share|improve this answer
add comment

Try this

C:\>cd "Program Files"

This will work.

share|improve this answer
add comment

You should try with

cd C:\Program\ Files
share|improve this answer
1  
No, he shouldn't. The backslash is a path separator here, not an escape character. He must either quote the path (as has already suggested) or escape spaces with backticks: cd C:\Program` Files –  Ansgar Wiechers Sep 23 '12 at 17:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.