1.    10 Oct 2017 #1
    Join Date : Apr 2016
    Posts : 44
    Windows 10

    matching wildcards in dir


    In a folder I have several files starting with test, like test00, test0000, test1.txt, test1111, test 01.txt

    If I do a dir test0*

    I expect to get all files which match test0* like test00 and test0000 but I also get test 01.txt and I'm not sure why. I mean "test 01.txt" to my thinking should not match test0*, right? wrong?

    I've been programming and using Windows since NT so now I feel kind of stupid.

    Or not??

    RON
      My ComputerSystem Spec
  2.    10 Oct 2017 #2
    Join Date : Jul 2015
    Posts : 3,755
    10 Pro

    For me dir works as expected in powershell but not cmd.

    cmd ignores the space in the filename (but not in the comparator eg dir "d:\temp\test "*)

    Code:
    Windows PowerShell
    Copyright (C) Microsoft Corporation. All rights reserved.
    
    PS C:\WINDOWS\system32> dir d:\temp
    
    
        Directory: D:\temp
    
    
    Mode                LastWriteTime         Length Name
    ----                -------------         ------ ----
    -a----        10-Oct-17     22:09              6 test 0.txt
    -a----        10-Oct-17     22:24              0 test 2.txt
    -a----        10-Oct-17     22:04              6 test0.txt
    -a----        10-Oct-17     22:04              6 test01.txt
    -a----        10-Oct-17     22:24              0 test2.txt
    
    
    PS C:\WINDOWS\system32> dir d:\temp\test0*
    
    
        Directory: D:\temp
    
    
    Mode                LastWriteTime         Length Name
    ----                -------------         ------ ----
    -a----        10-Oct-17     22:04              6 test0.txt
    -a----        10-Oct-17     22:04              6 test01.txt
    
    
    PS C:\WINDOWS\system32> cmd
    Microsoft Windows [Version 10.0.16299.15]
    (c) 2017 Microsoft Corporation. All rights reserved.
    
    C:\WINDOWS\system32>dir d:\temp\test0*
     Volume in drive D has no label.
     Volume Serial Number is 646D-8050
    
     Directory of d:\temp
    
    10-Oct-17  22:04                 6 test0.txt
    10-Oct-17  22:04                 6 test01.txt
    10-Oct-17  22:09                 6 test 0.txt
                   3 File(s)             18 bytes
                   0 Dir(s)  30,857,822,208 bytes free
    
    C:\WINDOWS\system32>dir "d:\temp\test "*
     Volume in drive D has no label.
     Volume Serial Number is 646D-8050
    
     Directory of d:\temp
    
    10-Oct-17  22:09                 6 test 0.txt
    10-Oct-17  22:24                 0 test 2.txt
                   2 File(s)              6 bytes
                   0 Dir(s)  30,857,822,208 bytes free
    
    C:\WINDOWS\system32>dir "d:\temp\test0"*
     Volume in drive D has no label.
     Volume Serial Number is 646D-8050
    
     Directory of d:\temp
    
    10-Oct-17  22:04                 6 test0.txt
    10-Oct-17  22:04                 6 test01.txt
    10-Oct-17  22:09                 6 test 0.txt
                   3 File(s)             18 bytes
                   0 Dir(s)  30,857,822,208 bytes free
    Not sure of the solution (except to use powershell)
      My ComputerSystem Spec
  3.    10 Oct 2017 #3
    Join Date : Apr 2016
    Posts : 44
    Windows 10
    Thread Starter

    THANKS! That "cleared" it up. I mean, it is something for some reason I never knew. Unfortunately this is not being run in either CMD or Powershell but in .NET/C#.

    It's not a problem in my code, I was just surprised.

    Well, it could be a problem for users who expect one thing and get another. If so I'll show them your explanation.

    RON
      My ComputerSystem Spec

 


Similar Threads
Thread Forum
Windows 10 Enterprise Image Matching
Sorry guys, I didn't know how to give this a proper title. Here's our situation... I work at a college where we have multiple images covering various needs. I've managed to pare this down to 2, being EMPLOYEE and PUBLIC. Here's the rub... We...
Installation and Upgrade
Two (non-matching) Graphics Cards
Hi folks, just installed Windows 10 Home 64-bit. I have two graphics cards, an NVidia GeForce 970 and an NVidia GeForce 570 Ti. I keep both in my rig, in spite of the fact that they can't SLi, because I use the 570 Ti as a PhsyX card and to drive...
Graphic Cards
Two matching User Accounts
Setting up Win 10 (upgrading from Vista) a year or two ago I found that I had created two matching accounts, one identified with my name , the other identified as This PC. Clicking on either leads to the same C:Users\mhalp_000\Desktop. Changing a...
User Accounts and Family Safety
Solved need help on matching profile pic to merge with the background
Hello, so i've managed to change the lockscreen image but im trying to fit my profile image to merge with the background making it look like i don't have a picture there since it's kinda ruining the background but im having really hard time trying...
Customization
Mixing and Matching UIKit with XAML and the Windows Bridge for iOS
Read more: Mixing and Matching UIKit with XAML and the Windows Bridge for iOS | Building Apps for Windows
Windows 10 News
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 08:05.
Find Us
Twitter Facebook Google+ Ten Forums iOS App Ten Forums Android App



Windows 10 Forums