Using Get-ChildItem -Exclude or -Include returns nothing

前端 未结 4 1895
醉话见心
醉话见心 2020-12-03 12:12

I have a list in my C: directory that has many files. If I try to run an -Exclude on it, I get no returns. Same with -Include. If I use filter it returns what I expected to

4条回答
  •  -上瘾入骨i
    2020-12-03 12:53

    Using 'C:' with no slash after it is the reason you're not getting the results you want. This is being interpreted as a relative path to the current directory instead of the root of the C drive. (See: Path with no slash after drive letter and colon - what does it point to?)

    If you use 'C:\' instead it should work as expected.

    Edit: My mistake; I was responding specifically to the examples which only use '-exclude'.

提交回复
热议问题