I'm currently going through Don's great book 'Powershell in a month of lunches' and really digging into the basics to solidify my understanding of the fundamentals.
So I was digging around testing the help menu examples for Get-ChildItem and was hoping for some clarification.
Now on my machine (windows 7, PS ver.3) the C:\Windows\Log\ directory contains a number of subdirectories and files, but using the wildcard or excluding it make no difference to the results I receive.
Both returns the same results, namely the first level files and folders in the C:\Windows\Logs directory, i.e. all of it's childitems. So I looked at the help more closely
So to me the use of a wildcard in the path string seems to be just a short hand way of filtering results and the explanation attached to 'example 7' is either outdated or just plain wrong.
Am I missing something here?
The explanation in the help file might be confusing. It's example 3 online (http://technet.microsoft.com/en-us/library/hh849800.aspx).
The -Path parameter specifies the child items you want to get. In this case, it's specifying a folder path, so you want the child items of that folder. Including a wildcard or not doesn't matter – you're not getting the item (the directory) either way. So in that regard, the explanation is, at the very least, confusing.
You CAN use a wildcard as a shorthand means of filtering – although that isn't what this example is doing.
However... this example deals with the filesystem. Get-ChildItem might behave slightly differently in a different provider.
Consider bugging the doc at connect.microsoft.com so Microsoft can clarify it.
You must be logged in to reply to this topic.