November 24th, 2010

You can filter the Common File dialog with wildcards

A customer reported an apparent inconsistency in the shell common file dialogs:

The question mark appears to be treated differently from other invalid file name characters. I tried to save a file in Paint under the name ?.jpg but instead of telling me that I had an invalid character in the file name (as it does with other characters like / < and |) or navigating to a new folder (like \ or *), it appears to do nothing.

Actually, it did do something. You just couldn’t tell because the result of that something was the same as doing nothing. If you type a wildcard like ? or * into a common file dialog, the dialog interprets this as a request to filter the list of files to those which match the wildcard you specify. In this particular example, typing ?.jpg says “Show me all the single-character files with the .jpg extension.” From the description in the original report, I gather that the customer’s tests took place in an empty directory (so the filter had no effect).

The customer responded with muted surprise.

Hmmmmm…..interesting. I hadn’t realized you can type in your own filter in dialog boxes. How long has this feature existed?

The ability to filter the common file dialog has been around since the dialogs were introduced in Windows 3.1.

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.