V
V
Vitaly Sergeev2011-10-05 17:10:59
PowerShell
Vitaly Sergeev, 2011-10-05 17:10:59

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

1 answer(s)
Y
Yaroslav Eremin, 2013-11-21
@YaroslavEremin

Good question. I myself use the construction of the form dir c:\windows -Filter *.exe
Apparently, it Includechecks the contents of the variable Path. At you in the second case Pathas a matter of fact transfers an array of objects. Therefore, it Includeworks.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question