Almost ashamed to say I was looking for some file on my laptop but could not find the exact query set I needed to work with. I was looking for all of my Camtasia recording and project files. It was pretty easy to get all of any one of the types of files. All I had to do for that is search on the extension. In the case of Project files it was .camproj and in the case of recording files it was .camrec. If I entered either of these in the search from Windows-F or the top of Explorer it gave me all the files of that type. I really wanted to look at both the project files and the recording files in the same window so I could sort, compare dates, etc. Well, one would think this is a pretty easy task. I tried:
Now I really needed this list so I turned to Bing to find the answer. Yes, as expected, it was there. However it was buried beneath a few drill downs before I found what I was looking for. In an attempt for me to have easy access to the proper syntax of the Windows Search for Windows 7 and to provide you with the solution without having to do a bunch of digging, I decided to do a detailed blog post on Windows 7 Search Syntax.
For Starters Let me share the solution to my problem. I found the solution in an MSDN post on Advanced Query Syntax. I needed to use an “OR” between the two search phases. In my case I had to search on [ .camrec OR .camproj ] and YES the OR IS CASE SENSITIVE! Notice above I did try “or” but I had it lower case so it did not work. I guess it was looking for all three phrases which did not appear.
Now with that problem solved let’s look at the Windows 7 Syntax in Detail…
A search query can include one or more keywords, with Boolean operators and optional criteria. These optional criteria can narrow a search based on the following:
The optional criteria, described in greater detail following, use the following syntax:
Suppose a user wants to search for a document containing the phase "last quarter," created by John or Joanne, and that the user saved to the folder mydocuments. The query may look like this:
"last quarter" author:(john OR joanne) foldername:mydocuments
Users can also limit their searches to specific types of files, called file kinds. The following table lists the file kinds and offers examples of the syntax used to search for these kinds of files.
Users can search on specific properties of different file kinds. Some properties (like file size) are common to all files, while others are limited to a specific kind. Slide count, for example, is specific to presentations. The following tables list these properties by file kind.
These are properties common to all file kinds. To include all types of files in a query, the syntax is:
where <property> is a property listed below and <value> is the user-specified search term.
Search keywords and file properties can be combined to broaden or narrow a search with operators. The following table explains common operators used in a search query.
LOOK => This is the one that solved my problem
The operators AND, NOT and OR must be in uppercase and cannot be combined in one query (e.g., social OR security NOT retirement).
social OR security NOT retirement
social NOT security
Finds items that contain social, but not security.
social OR security
Finds items that contain social or security.
Finds items that contain the exact phrase social security.
Finds items that contain social and security in any order.
Finds items with a date after 11/05/04.
Finds items with a size greater than 500 bytes.
Finds items with a date before 11/05/04.
Finds items with a size less than 500 bytes.
Finds items with a date beginning on 11/05/04 and ending on 11/10/04.
In addition to searching on specific dates and date ranges using the operators described earlier, AQS allows relative date values (like today, tomorrow, or next week) and day (like Tuesday or Monday..Wednesday) and month (February) values.
specify a date range, type the property followed by two dates. For example, type from:david sent:11/05/06..11/05/07. Windows Search recognizes all Windows date formats and also recognizes the following values:
Finds items with today's date.
Finds items with tomorrow's date.
Finds items with yesterday's date.
Finds items with a date falling within the current week.
Finds items with a date falling within the previous week.
Finds items with a date falling within the upcoming week.
Finds items with a date falling within the previous month.
Finds items with a date falling within the upcoming year.
Searches for a date in the Date property between the values 2/7/05 and 2/10/05, excluding the end dates.
Searches for a date in the Date property between the values 2/7/05 and 2/10/05, including the end dates.
date:2/7/05 .. 2/10/05
Same as date:>=2/7/05<=2/10/05
Searches for files with a value in the Size between50 KB and 70 KB, excluding the end values.
Searches for files with a value in the Size property between 50 KB and 70 KB, including the end values.
Same as size:>=50KB <=70KB
These are properties common to attachments. To limit the search to attachments only, the syntax is:
These are properties common to contacts. To limit the search to contacts only, the syntax is:
Phone numbers are indexed as entered. For example, if a user did not include a country or area code when entering the phone number, users will not be able to locate a contact if searching with country or area code in the phone number.
These are properties common to communications. To limit the search to communications only, the syntax is:
These are properties common to calendars. To limit the search to calendars only, the syntax is:
These are properties common to documents. To limit the search to documents only, the syntax is:
These are properties common to presentations. To limit the search to presentations only, the syntax is:
These are properties common to music files. To limit the search to music only, the syntax is:
These are properties common to pictures. To limit the search to pictures only, the syntax is:
These are properties common to videos. To limit the search to videos only, the syntax is:
There is a Windows Search Overview page at: Windows Search Overview
More information available for using Advance Query Syntax Programmatically at Using Advanced Query Syntax Programmatically
Absolutely wonderful. got my search to work thanks to this.
Needed to search a set of folders in outlook in a set date bracket and not display the attachments.
I have seen a lot about complicated searches but nothing explaining my problem. I have a lot of files with names containing the string 2.6 but Windows Search will not find any of them. What is the problem.
Hi Bruce, Thanks for the feedback. Try enclosing your string in quotes "2.6" this should work
GREAT blog. I consider myself "gifted in the art of windows search" but even I learned a few valuable tips from what you listed here.
My main issue now is -- how do I recall previous searches from history to modify? I'm used to unix/cygwin or DOS where up-arrow will recall previous commands so you can edit them, tweak, modify, improve, etc. I find in searching that I'll craft some lengthly search syntax, find an item and then upon realizing it's not what I was looking for, I had to re-type in the search phrase.
I know I can just press [enter] and bring up the windows-explorer-based version of search, where it keeps the search string in the upper right hand corner so I can modify, but I'd really like a history key to bring up previous search phrases.
If you know it, let me know!
In Outlook 2010 I need to search mail items for #02. So I enter "#02" in the Instant Search. What are my results?! Any mail item containg "02" or could be "<any number>02". Everywhere I look sites say throw a phrase in quotes to find exact match, but that obviously is not true, and I haven't seen any site saying the pound key ('#') has any special significance.
Anyone have any idea how to search for "#02" in Outlook?
"social security" Finds items that contain the exact phrase social security.
NOPE. Quotes make no difference, whatsoever.