2 Attachment(s)
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
Attachment 187601
Attachment 187602
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.
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.
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.
Re: Workaround for "?" wildcard search?
I thought I posted to the VB.Net forum. Sorry. My bad. :(
Re: Workaround for "?" wildcard search?
Quote:
Originally Posted by
Mugsy323
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.
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.
https://www.vbforums.com/images/ieimages/2023/05/7.png
It looks like wrapping the search term in quotes will do what you want. "File????.pes"
https://www.vbforums.com/images/ieimages/2023/05/8.png
Re: Workaround for "?" wildcard search?
Oooo. I need to try this (wrapping the search term in quotes in my code.)
Thx.