Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I've got a script that I'm running where I declare the path I'm using, then define my source files as all the child items in that path.

$htmPath = "c:\users\x\desktop\cgc\ht"
$srcfiles = Get-ChildItem $htmPath -filter "*.htm*"

I've run this successfully in the past, but this morning I started getting the following error:

You must provide a value expression on the right-hand side of the '*' operator.
At C:\users\x\desktop\cgc\CGC002.PS1:63 char:46
+ $srcfiles = Get-ChildItem $htmPath -filter "* <<<< .htm*"
    + CategoryInfo          : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : ExpectedValueExpression

To me, it appears that this error is being thrown because the script is interpreting my wildcard as a multiplication, and wants the value on the right side necessary to complete the operation. Am I interpreting it properly? If that is indeed the case, how do I make sure that my wildcard is interpreted as a widlcard?

I did find this link, but it's a different enough scenario with different enough code that I'm not sure it applies. However, I did find this comment in the thread interesting:

Try putting the *, at the start of the property list instead of the end. I think it's just getting confused. It's mainly your formatting.

...so I exited PS, warm-booted, the usual did-you-try-turning-it-off-and-back-on-again confusion resetters, and still, the same error.

Maybe I have a typo somewhere that I can't see?

Or, if I'm completely missing the interpretation of the error...school me.

share|improve this question
up vote 0 down vote accepted

Ended up being a single double-quote off the right side of my text editor. Color coded syntax checking helped me verify that it was a mismatched quote issue...thinking to scroll to the right to FIND the " took a lot more time than it should have. Facepalm.

Thanks to @Richard who offered up this suggestion.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.
{"cc_re__cc_re__cc_by_sa_3_0": ["                    <li><a href=\"//area51.stackexchange.com\" title=\"proposing new sites in the Stack Exchange network\">Area 51</a></li>\r\n                        <li><a href=\"//careers.stackoverflow.com\">Stack Overflow Careers</a></li>\r\n                    \r\n                </ol>\r\n            </td>\r\n    </tr>\r\n</table>\r\n                </div>\r\n            </div>\r\n            <div id=\"copyright\">\r\n                site design / logo &#169; 2016 Stack Exchange Inc; user contributions licensed under <a href=\"https://creativecommons.org/licenses/by-sa/3.0/\" rel=\"license\">cc by-sa 3.0</a> \r\n                with <a href=\"http://blog.stackoverflow.com/2009/06/attribution-required/\" rel=\"license\">attribution required</a>\r\n            </div>\r\n            <div id=\"svnrev\">\r\n                rev 2016.5.26.3618\r\n            </div>\r\n        </div>\r\n    </div>\r\n    <noscript>\r\n        <div id=\"noscript-warning\">Stack Overflow works best with JavaScript enabled<img src=\"http://pixel.quantserve.com/pixel/p-c1rF4kxgLUzNc.gif\" alt=\"\" class=\"dno\"></div>\r\n    </noscript>\r\n<scrip"], "copyright__copyright__copyright": ["-quote off the right side of my text editor. Color coded syntax checking helped me verify that it was a mismatched quote issue...thinking to scroll to the right to FIND the \" took a lot more time than it should have. Facepalm.\n\nThanks to @Richard who offered up this suggestion.\n\nshare|improve this answer\n\nYour Answer\n\n\u00a0\ndiscard\n\nBy posting your answer, you agree to the privacy policy and terms of service.\n\nNot the answer you're looking for? Browse other questions tagged or ask your own question."]}