Answer the question
In order to leave comments, you need to log in
Powershell - Get-ChildItem -Include working puzzle
Help, brothers!
The following two commands give different results for me:
1. dir c:\windows -Include *.exe
2. dir c:\windows\* -Include *.exe
At the same time, the same result is obtained in this case:
1. dir c:\windows
2. dir c:\windows\*
The help to Get-ChildItem honestly says that -Include doesn't work in the first case. But why? What for? I can't understand the internal logic.
Answer the question
In order to leave comments, you need to log in
Good question. I myself use the construction of the form dir c:\windows -Filter *.exe
Apparently, it Include
checks the contents of the variable Path
. At you in the second case Path
as a matter of fact transfers an array of objects. Therefore, it Include
works.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question