0

I seem to be able to exclude any map with powershell using the following command:

Get-ChildItem -Path $folder -Exclude windows,program files  -Recurse  | 
    where {$_.Attributes -match 'Directory'}  |
    ForEach-Object {$_.FullName} > $search_pro 

not Program Files (86) though? any thoughts on why this is.

thank you in advance

I typed the full name of the map but it refused.

boxdog
  • 7,894
  • 2
  • 18
  • 27
Codeman
  • 1
  • 1
  • In short: arguments that contains _spaces_ (and/or other metacharacters, such as `(`, `)` and `&`) must be _quoted_, e.g, `'Program Files'`). See the linked duplicate for details. – mklement0 Mar 03 '23 at 17:39
  • As an aside: Due to the lack of quoting, `-Exclude windows,program files` also doesn't work as you intend: `files` becomes its own argument, which positionally binds to the `-Filter` parameter. – mklement0 Mar 03 '23 at 17:44
  • 1
    thank you very much for sharing your knowledge, I feel like I was able to resolve the issue. – Codeman Mar 03 '23 at 18:00

0 Answers0