The Computer Oracle

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

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Take control of your privacy with Proton's trusted, Swiss-based, secure services.
Choose what you need and safeguard your digital life:
Mail: https://go.getproton.me/SH1CU
VPN: https://go.getproton.me/SH1DI
Password Manager: https://go.getproton.me/SH1DJ
Drive: https://go.getproton.me/SH1CT


Music by Eric Matyas
https://www.soundimage.org
Track title: Future Grid Looping

--

Chapters
00:00 Cannot Cd To A Folder With Spaces In The The Folder Path
00:34 Answer 1 Score 5
00:44 Answer 2 Score 45
00:53 Accepted Answer Score 16
01:18 Answer 4 Score 8
01:25 Thank you

--

Full question
https://superuser.com/questions/478679/c...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#powershell

#avk47



ANSWER 1

Score 45


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

cd "C:\Program Files"



ACCEPTED ANSWER

Score 16


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 3

Score 8


You can also use the ProgramFiles environment variable

cd $env:ProgramFiles



ANSWER 4

Score 5


Try this

C:\>cd "Program Files"

This will work.