문제

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?

도움이 되었습니까?

해결책

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

You can also throw it into a variable first.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top