I'm tryin to change my working directory using set-location. This is what I've done so far:

Set-Location H:\09- DISTRIBUTION\engineer\drft-tmp\310-DOUGLAS\60kV BLDG Design DWGs

Here is the error:

Set-Location : A positional parameter cannot be found that accepts argument 'DISTRIBUTION\engineer\drft-tm
At line:1 char:13
+ Set-Location <<<<  \09- DISTRIBUTION\engineer\drft-tmp\310-DOUGLAS\60kV BLDG Design DWGs
    + CategoryInfo          : InvalidArgument: (:) [Set-Location], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.SetLocationCommand

I'm still a noob. How should I approach this problem?

  • Hi DATAfiend. I edited your question to clean it up a bit, and give it a better title. However, I get the feeling that you have some spaces (and at least one newline) in there that doesn't belong. Can you check to make sure that what you tried matches what's in the question now, and edit further if not?
    – user
    Commented Mar 17, 2016 at 14:45
  • @root Please don't post answers as comments.
    – user
    Commented Mar 17, 2016 at 14:46

2 Answers 2


Say you have an app called TestParam that takes any number of parameters and echoes them back on newlines:

>TestParam thisisatest

When there are spaces it considers them a separator between parameters:

>TestParam this is a test

It is the same as typing Test "This" "is" "a" "test" and you're essentially passing four different strings. If you want to pass a single parameter that has spaces:

>TestParam "This is a test"
This is a test

When you look at the error it is saying it can't find a parameter for "DISTRIBUTION\engineer\drft-tm\60kV" which is the second parameter your command is passing to it because you have spaces. If your path has spaces, that's fine, but you need to tell PowerShell that it's all a single parameter and all just one string:

Set-Location "H:\09- DISTRIBUTION\engineer\drft-tmp\310-DOUGLAS\60kV BLDG Design DWGs"
  • "You 'da man!" Many thanks! I never knew about the quotation requirement.
    – DATAfiend
    Commented Mar 17, 2016 at 19:29

Surround the folder path with double quotes so it reads:

Set-Location "H:\09- DISTRIBUTION\engineer\drft-tmp\310-DOUGLAS\60kV BLDG Design DWGs"
  • Surrounding in quotes = answer. Removing Spaces = bad idea. :) Commented Mar 17, 2016 at 14:52
  • Ok, so NO spaces when you're typing in the path? Who knew?, ok, let me check.
    – DATAfiend
    Commented Mar 17, 2016 at 14:52
  • still struggling...
    – DATAfiend
    Commented Mar 17, 2016 at 15:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .