![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | DIR problem I have a folder "c:\test" with two files in it "test.txt" and "test.xls". When I run cmdlet "dir c:\test -Exclude *.xls" the cmdlet is executed as expected - it returns the txt file, however cmdlet "dir c:\test -Include *.txt" returns nothing. Anybody could explain it ? |
My System Specs![]() |
| | #2 (permalink) |
| | Re: DIR problem Pisioo wrote: > I have a folder "c:\test" with two files in it "test.txt" and "test.xls". > When I run cmdlet "dir c:\test -Exclude *.xls" the cmdlet is executed as > expected - it returns the txt file, however cmdlet "dir c:\test -Include > *.txt" returns nothing. Anybody could explain it ? Get-Help excerpt: -include <string[]> Retrieves only the specified items. The value of this parameter qualifies the Path parameter. Enter a path element or pattern, such as "*.txt". Wildcards are permitted. The Include parameter is effective only when the command includes the Recurse parameter or the path leads to the contents of a directory, such as C:\Windows\*, where the wildcard character specifies the contents of the C:\Windows directory. So, you should write "dir c:\test\* -Include *.txt" |
My System Specs![]() |
| | #3 (permalink) |
| | RE: DIR problem That's an easy one. The help explanation for -include states: "-include <string[]> .... The Include parameter is effective only when the command includes the Recurse parameter or the path leads to the contents of a directory, such as C:\Windows\*, where the wild card character specifies the contents of the C:\Windows directory." Try "dir c:\test\* -Include *.txt" "Pisioo" wrote: > I have a folder "c:\test" with two files in it "test.txt" and "test.xls". > When I run cmdlet "dir c:\test -Exclude *.xls" the cmdlet is executed as > expected - it returns the txt file, however cmdlet "dir c:\test -Include > *.txt" returns nothing. Anybody could explain it ? |
My System Specs![]() |
| | #4 (permalink) |
| | Re: DIR problem Hi, The semantics of the get-childitem cmdlet have given rise to concern during the development of PowerShell 1.0. See, for example, https://connect.microsoft.com/feedba...9321&SiteID=99. Unfortunately, in my view, fixing these issues was postponed beyond release of version 1.0. In your scenario most people would expect dir C:\Test -Include Test.txt and dir C:\Test\* -Include Test.txt to give the same results. They don't, as you can confirm. That seems to me to be undesirable behaviour. Can any of the PowerShell team comment on when it is planned that the semantics will be reviewed and fixed? Thanks Andrew Watt MVP On Sun, 7 Jan 2007 07:38:01 -0800, Pisioo <Pisioo@discussions.microsoft.com> wrote: >I have a folder "c:\test" with two files in it "test.txt" and "test.xls". >When I run cmdlet "dir c:\test -Exclude *.xls" the cmdlet is executed as >expected - it returns the txt file, however cmdlet "dir c:\test -Include >*.txt" returns nothing. Anybody could explain it ? |
My System Specs![]() |
| | #5 (permalink) |
| | Re: DIR problem There is no definite timeline for its fix, although this is something that we are aware of, and indeed want to make right. -- Lee Holmes [MSFT] Windows PowerShell Development Microsoft Corporation This posting is provided "AS IS" with no warranties, and confers no rights. "Andrew Watt [MVP]" <SVGDeveloper@aol.com> wrote in message news:6ps9q2hh7e4our79civ9hgi1hgubnnu9a4@4ax.com... > Hi, > > The semantics of the get-childitem cmdlet have given rise to concern > during the development of PowerShell 1.0. See, for example, > https://connect.microsoft.com/feedba...9321&SiteID=99. > Unfortunately, in my view, fixing these issues was postponed beyond > release of version 1.0. > > In your scenario most people would expect > > dir C:\Test -Include Test.txt > > and > > dir C:\Test\* -Include Test.txt > > to give the same results. They don't, as you can confirm. That seems > to me to be undesirable behaviour. > > Can any of the PowerShell team comment on when it is planned that the > semantics will be reviewed and fixed? > > Thanks > > Andrew Watt MVP > > On Sun, 7 Jan 2007 07:38:01 -0800, Pisioo > <Pisioo@discussions.microsoft.com> wrote: > >>I have a folder "c:\test" with two files in it "test.txt" and "test.xls". >>When I run cmdlet "dir c:\test -Exclude *.xls" the cmdlet is executed as >>expected - it returns the txt file, however cmdlet "dir c:\test -Include >>*.txt" returns nothing. Anybody could explain it ? |
My System Specs![]() |
| | #6 (permalink) |
| | Re: DIR problem "Lee Holmes [MSFT]" <lee.holmes@online.microsoft.com> wrote in message news:uD6l9HONHHA.2236@TK2MSFTNGP02.phx.gbl... > There is no definite timeline for its fix, although this is something that > we are aware of, and indeed want to make right. > I wonder if the answer to this could be a modified wildcard syntax that somehow allowed you to specify the exclude info as part of the search pattern e.g.: gci *.txt!foo* or something like that. I'm a bit skeptical on the value of the -include functionality since it seems that a more specific search pattern obviates the need for the -Include parameter. This approach would also get rid of two parameters (-Include and -Exclude). -- Keith |
My System Specs![]() |
| | #7 (permalink) |
| | Re: DIR problem dir c:\test\*.txt "Pisioo" <Pisioo@discussions.microsoft.com> wrote in message news:81B4E9F9-0289-4841-9219-A67274977A13@microsoft.com... >I have a folder "c:\test" with two files in it "test.txt" and "test.xls". > When I run cmdlet "dir c:\test -Exclude *.xls" the cmdlet is executed as > expected - it returns the txt file, however cmdlet "dir c:\test -Include > *.txt" returns nothing. Anybody could explain it ? |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| the problem with ndis.sys Blue Screen of Death problem solved? | Vista General | |||
| Re: Windows Mail Attachement Problem and Adobe Player Problem with IE8 | Vista mail | |||
| Multi-select problem in Windows Explorer BIG PROBLEM!!!!!! | Vista General | |||
| Generic McAfee Problem Message in Vista Problem Reports | Vista performance & maintenance | |||
| Vista Upgrade Problem - Windows Explorer Loop problem | Vista installation & setup | |||