Windows Search Fu 

Not many people know that the search box in Windows Explorer allows you to do some powerful advance searching. Unfortunately, the syntax is not very well known or documented.  Below is from an article I think originally from Arstechnica. I saved it to a PDF format long ago and wish I remember the original source so I could give credit. Anyway, if you are looking for a file and can’t find it, the following advance query syntax might be your best chance at finding it.

Advanced Query Syntax

Advanced Query Syntax (AQS) is the official set of rules that Windows Search follows when interpreting what you type in the search box. In addition to keywords, AQS supports three main types of search parameters: file properties (size, date, tags, and so on), kinds of items (folders, documents, music, images, videos, e-mails, and so on), as well as data stores (databases and locations containing indexed items). Each of these parameter names is followed by a colon (loose), or a colon and equals sign (strict), and then a value for that operator that the user wants to specify. Below are some of the most common forms of AQS. We use the loose method in all of our examples as it brings up more results and is typically the more popular choice.

File properties

You can always further narrow down your search if you know a certain property of a file. When looking for a file at first, you may not think you know much about it, but after you read the list below you’ll realize that you actually know a lot more than you’d think. Here are a few properties that certain types of files can have. We will look at some more closely a bit later.

All files – title:manager, status:active, date:lastweek, datemodified:lastweek or modified:lastweek, importance:high or priority:high, size:>50MB, deleted:true or isdeleted:true, isattachment:false, to:johnsmith or toname:johnsmith, cc:david or ccname:david, company:Microsoft, category:business modified:lastweek keywords:sports, album:greatest, file:2006hits or filename:2006hits, genre:jazz, author:david or by:david, under:administration or path:administration or folder:adminstration, fileext:.rtf or ext:.rtf, keyword:personal or tag:personal, and type:image.

Contact files – jobtitle:manager, imaddress:luis@adventure-works.com, assistantsphone:555-1212, assistantname:roberto, profession:accountant, nickname:louis, spouse:susana, businesscity:redmond, businesspostalcode:98052, businesshomepage:www.microsoft.com, callbacknumber:882-8080, carphone:555-1212, children:anna, firstname:emil, lastname:protalinski, homefax:555-1212, manager:eric, pager:882-8080, businessphone:555-1212, homephone:555-1212, mobilephone:882-8080, officelocation:red/101, anniversary:yesterday, and birthday:tomorrow

Communication files (e-mail, appointments) – from:simon, sent:yesterday, subject:budget, hasattachment:true, attachment:presentation.ppt, bcc:michael or bccname:Michael, bcc:p_emil@hotmail.com or bccaddress:p_emil@hotmail.com, ccaddress:editors@arstechnica.com or cc:editors@arstechnica.com, flagstatus:completed, toaddress:p_emil@hotmail.com, duedate:03/23/2010 or due:03/23/2010, read:false or isread:false, iscompleted:true, incomplete:true, isflagged:false or hasflag:false, and duration:>120

Calendar files – isrecurring:true or recurring:true, by:emil or from:emil or organizer:emil, and location:toronto

Document files – comments:excellent, lastsavedby:aaron, documentmanager:jon, revisionnumber:4a, datelastprinted:yesterday, and slides:>20

Music files – bitrate:>150kbps, artist:U2, year:1977..1987, album:”greatest hits”, genre:rock, lyrics:”happy birthday to you”, #:12 or track:12, and year:>1980<1990

Picture files – cameramake:Nikon, cameramodel:eclipse, dimensions:8×10, orientation:landscape, taken:last or datetaken:6/12/2006, width:33, height:66, and flashmode:no flash

Recorded TV files – broadcastdate:2005, channel:7, closedcaptioning:true, datereleased:2007, and episodename:zeppo

Video files – name:vacation, subject:Hawaii, and ext:wma or filext:wma

Datemodified

You can use datemodified for searching by the date a file was modified.

Datemodified:23/02/2010, Datemodified:23/02/10, Datemodified:yesterday, Datemodified:lastweek, Datemodified:pastmonth, Datemodified:21/02/04..2/3/09

Kind

You can use “kind” for searching by the properties of a document type. Here are a few examples:

kind:everything, kind:communications, kind:contacts, kind:email, kind:im, kind:meetings, kind:tasks, kind:notes, kind:docs, kind:text, kind:spreadsheets, kind:presentations, kind:music, kind:pics, kind:videos, kind:folders, foldername:mydocs or in:mydocs, kind:favorites, and kind:programs

Although “foldername” and “in” are not the “kind” operator, they’re worth mentioning as they restrict a search to a particular folder or a database containing certain types of items. There’s also store; store:mapi will return items in your Microsoft Office Outlook 2007 profile and store:csc will return offline files.

Type

You can use “type” for searching by file type. Here are a few examples:

type:image, type:.doc, type:.pdf, type:excel, type:mp3

It’s important to note that the search syntax will not let you use two or more search terms (trying “type:.docx, .pdf” will not bring up search results for all Word and PDF files). Furthermore, searching by file name extension still works (such as *.txt or ext:*.txt) but the results include files that incorporate the extension in their contents as well as in their file names. If you don’t want this, that’s what the above Kind and Type parameters are for.

Boolean

Remember that you can also use Boolean Operators as well as Boolean Properties. Here are a few examples of each:

Boolean Operators: social NOT security, social -security, social OR security, “social security”, (social security), date:>11/05/04size:>500, date:<11/05/04 size:<500, and date:11/05/04..11/10/04

Boolean Properties: report is:attachment (same as isattachment:true), essay isonline:true, article isrecurring:true, news isflagged:true, brief isdeleted:true, feature iscompleted:false, mail hasattachment:true, and tweak hasflag:true

Date and size ranges

We’ve already touched upon numbers and ranges with the examples above, but it’s still important to illustrate the different variations. There are Days (Sunday, Monday … Saturday) and Months (January, February … December). In addition to relative dates (today, tomorrow, and yesterday) there are multi-word relative dates (this week, next month, last week, past month, and coming year) that can be contracted (thisweek, nextmonth, lastweek, pastmonth, and comingyear). Windows Search recognizes all Windows date formats so you don’t have to worry and can type in the date in the format you’re used to.

To specify a date range, type the property followed by two dates (from:eric sent:11/05/08..11/05/09). In general, date:>2/7/05<2/10/05 will give you files dated between the values 2/7/05 and 2/10/05, excluding the end dates, and date:>=2/7/05<=2/10/05 or date:2/7/05 .. 2/10/05 will include the end dates. You can use the same range tricks when you know the approximate size of a file. To search for files with a value in the Size between 69KB and 420KB, excluding the end values, use size:>69KB <420KB. If you want to include end values, use size:>=69KB <=420KB or size:69KB..420KB.