Pergunta

I am passing a directory into a powershell script. I have done this before, but apparently I haven't done it with a directory that has spaces in it: For example...

C:\Program Files (x86)\Microsoft SDks\Windows\v7.0A\bin\

Well, simple enough right, just surround it with paren's right? Wrong... When it is in my actual script it is throwing the following anoying exception:

The term 'x86' is not recognized as the name of a cmdlet, function, script file
, or operable program. Check the spelling of the name, or if a path was include
d, verify that the path is correct and try again.
At line:1 char:275

This is being passed into my script as a parameter btw, hence why it is throwing the error at line 1.

Any advice on passing directories as paramters into powershell scripts?

Foi útil?

Solução

Try putting into into quotes, single or double will work.

You can also throw it into a variable first.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top