Cannot cd to a folder with spaces in the the folder path
I am trying to cd to the Program Files directory, but I'm getting an error. Here is the screen shot.
Here's the command I'm running and the error message:
2PS 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
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~1Also try:
cd C:\Program* You should try with
cd C:\Program\ Files 2 More in general
"Zoraya ter Beek, age 29, just died by assisted suicide in the Netherlands. She was physically healthy, but psychologically depressed. It's an abomination that an entire society would actively facilitate, even encourage, someone ending their own life because they had no hope. Th…"