Get-ChildItem and 'Filter' parameter misissue
Votes from Connect: 14
Original Date Submitted: 6/14/2011 7:44:51 PM
Description:
Contact Information
Handle: Vadims Podans
Site Name: PowerShell
Feedback ID: 675309
Frequency: Always Happens
Regression: Yes, this happens in all previous versions
Problem Description:
'-Filter' parameter tries to bind filter pattern to a both general name and a name in the 8.3 notation (MS-DOS format). This causes that in the 'Get-ChildItem -Filter' output appears unexpected items. For details see repro section.
Also this may cause catstrophic results if Get-ChildItem output is passed to Remove-Item cmdlet. Administrator will not expect that Program Files folders will match this pattern. Also PowerShell haven't native ways to determine certain object (file or folder) short name in 8.3 notation and returned object doesn't contain related property. This can be done dy running 'dir.exe' with /x switch.
Also documentation has no mention about this behavior.
Product Studio item created by Connect Synchronizer due to creation of feedback ID 675309 (http://connect.microsoft.com/PowerShell/feedback/ViewFeedback.aspx?FeedbackID=675309).
Repro Steps:
[↓] [vPodans] dir c:\ -Filter *1
Directory: C:\
Mode LastWriteTime Length Name
d-r-- 08.04.2011. 1:08 Program Files
[↓] [vPodans] dir c:\ -Filter *2
Directory: C:\
Mode LastWriteTime Length Name
d-r-- 24.02.2011. 8:30 Program Files (x86)
[↓] [vPodans]
Expected Results:
Since neither of outputed objects matches this pattern nothing should be returned unless any object name ends with '1'.
Internal BugId: 2944

1 comment
-
Joel "Jaykul" Bennett commented
You just need to run:
fsutil.exe behavior set disable8dot3 1