Results 1 to 8 of 8

Thread: Workaround for "?" wildcard search?

  1. #1

    Thread Starter
    Lively Member Mugsy323's Avatar
    Join Date
    Oct 2014
    Posts
    83

    Question Workaround for "?" wildcard search?

    I discovered (and reported) a bug in Windows (11 only?) where searches using the "?" wildcard produce the same result as using the "*" wildcard (works fine from the "DOS" Command Prompt.)

    The "?" wildcard should only match a single character while "*" matches a string of any length.

    I was trying to count how many files matching "File####.pes" were in a folder, but VS returns any filename matching "File*.pes" (see attached screenshots.)

    I need a way to "filter" my search results to return only files that match a specific pattern. TIA

    Name:  misapplied wildcard.jpg
Views: 108
Size:  79.2 KB

    Name:  dos wildcard correct.jpg
Views: 121
Size:  82.4 KB
    Last edited by Mugsy323; May 10th, 2023 at 02:28 PM.

  2. #2
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,334

    Re: Workaround for "?" wildcard search?

    El Cheapo quick and easy workaround:

    Pipe the Dir output to a text file.
    Open that text file in Notepad and remove any unwanted information,
    Paste the information you do want into Excel. Now you have lots of filter or find options.

    If this is regularly scheduled task that you want to automate, there are other solutions.

  3. #3

    Thread Starter
    Lively Member Mugsy323's Avatar
    Join Date
    Oct 2014
    Posts
    83

    Re: Workaround for "?" wildcard search?

    Thx for the reply, but this all has to be automated within my utility. I can't ask users to edit files by hand in mid process before the program can continue.

  4. #4
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,489

    Re: Workaround for "?" wildcard search?

    What is the utility? Is it a program? If so, what is it written in? It seems like this is a problem that could be solved relatively easily in some languages, but that this seems more like a batch process utility.
    My usual boring signature: Nothing

  5. #5

    Thread Starter
    Lively Member Mugsy323's Avatar
    Join Date
    Oct 2014
    Posts
    83

    Re: Workaround for "?" wildcard search?

    I thought I posted to the VB.Net forum. Sorry. My bad.

  6. #6
    PowerPoster
    Join Date
    Nov 2017
    Posts
    2,760

    Re: Workaround for "?" wildcard search?

    Quote Originally Posted by Mugsy323 View Post
    I thought I posted to the VB.Net forum. Sorry. My bad.
    You did, but it probably got moved since the original post kind of glossed over any relevance to VB.

    Not sure how much heavy lifting you want your code to do, but one simple way would be to ensure that the length of the "Search For" string is equal to the length of the resulting filename, discarding filenames that are longer.

  7. #7
    Member
    Join Date
    Jul 2017
    Posts
    43

    Re: Workaround for "?" wildcard search?

    Can confirm it's the same problem on Windows 10. If you click into the search bar, you'll see the query it's using. It will be like this:

    search-ms:displayname=Search%20Results%20in%20New%20folder&crumb=filename%3A~file????.txt%20OR%20System.Generic.String%3Afile????.txt&crumb=location:J%3A%5CMisc%5CNew%20folder

    You can remove the bit in bold and then the query works fine.



    It looks like wrapping the search term in quotes will do what you want. "File????.pes"




  8. #8

    Thread Starter
    Lively Member Mugsy323's Avatar
    Join Date
    Oct 2014
    Posts
    83

    Re: Workaround for "?" wildcard search?

    Oooo. I need to try this (wrapping the search term in quotes in my code.)

    Thx.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width