0

I tried to go to another directory using windows 10 powershell. It's located in my E:\SEMESTER 7 directory. But, when I typed on my windows powershell cd semester 7 it always gives me an error. I tried with another directory file which is not contain number on it,and it worked. How do I make it work for directory file that contains number?

Here is the screenshot:

enter image description here

Mathias R. Jessen
  • 157,619
  • 12
  • 148
  • 206
glx
  • 11
  • 5
  • 4
    When directory name has spaces, use single or double quotes: `cd "semester 7"` or `cd 'semester 7'`. – vonPryz Sep 17 '20 at 13:52
  • 1
    Please do not post pictures of code [An image of your code is not helpful](https://idownvotedbecau.se/imageofcode) – Olaf Sep 17 '20 at 13:53
  • I would say `Set-Location -Path "semester 7"`, _(if you wish to use aliases, then `sl "semester 7"`)_, or `Set-Location -LiteralPath 'semester 7'`, _(using aliases, `sl -l 'semester 7'`)_. – Compo Sep 17 '20 at 14:32
  • @vonPryz - StackExchange (all sites) generally discourages answering questions in the comments. Please propose your comment as an Answer. – Jeff Zeitlin Sep 17 '20 at 15:04
  • The answers to the [linked post](https://stackoverflow.com/questions/63983406/unable-to-move-forward-using-cd) explain why _quoting_ a path that contains spaces passed as an argument to `Set-Location` (one of whose built-in aliases is `cd`) is necessary . – mklement0 Sep 20 '20 at 22:25

1 Answers1

0

Tab completion finishes it this way:

cd '.\semester 7\'

js2010
  • 23,033
  • 6
  • 64
  • 66