Microsoft

Return Windows Search results within a date range with advanced feature

Greg Shultz introduces you to Vista's Advanced Query Syntax and shows you how to use it in conjunction with Windows Search to search for a particular file, or a set of files, that you know were created between a certain set of dates.

Have you ever needed to search for a particular file or a set of files that you know you created between a certain set of dates? If you are running Microsoft Windows XP, performing such a search from the Search Companion was as easy as expanding the When Was It Modified? Section, selecting the Specify Dates option button, and either typing the dates in the From and To boxes or selecting the dates from the drop-down calendars. For example, to search for the .doc files you created between November 1 and November 30, you'd configure the Search Companion as shown in Figure A.

Figure A

Using Windows XP's Search Companion to search for .doc files you created between November 1 and November 30 is a snap.
However, in Vista, the Search Folder's Date searching options do not allow you to choose beginning and ending dates. By default, the drop-down lists in the Date Configuration section allows you to choose only Is Before or Is After, as shown in Figure B.

Figure B

The Search Folder doesn't allow you to search for files created between dates.

To search for files that you created between November 1 and November 30 in Vista, you have to turn to the Advanced Query Syntax used by Windows Search.

In this issue of the Microsoft Windows Vista and Windows 7 Report, I'll introduce you to Vista's Advanced Query Syntax and show you how to use it in conjunction with Windows Search. As I do, I'll show you how to search for a particular file or a set of files that you know were created between a certain set of dates.

This blog post is also available in PDF format in a TechRepublic download.

The Advanced Query Syntax

Searching for files using the Advanced Query Syntax is really easy, and once you get the hang of it, you'll instantly appreciate the power that it puts at your fingertips when you need to narrow your search to find a particular file or set of files. Using Advanced Query Syntax, you can target your searches using a variety of special search parameters that allow you to define specific locations, file types, file properties, and even a special set of parameters called file kinds. You can then augment your searches using Boolean operators, Boolean properties, and wildcards.

The basic syntax for the Advanced Query Syntax is:

[<search string>] [<scope>:<value>] [<file kind>:<value>] [<property name>:<value>]

You can find a detailed listing of all the available search parameters and many examples of the Advanced Query Syntax on the Windows Search page on Microsoft's Web site.

Now, while the Advanced Query Syntax can be used in a stand-alone fashion, many of its features are built in to Window Search. However, you can easily build your targeted searches using a combination of Windows Search and Advanced Query Syntax features.

Example search

Let's take a look at an example of combining the Advanced Query Syntax and Windows Search by going back to my original goal of searching for files created between November 1 and November 30. Launch Windows Explorer, right-click on Documents, and select the Search command. You would then use the Advanced Query Syntax date property to specify the date range as:

date:>=11/1/08<=11/30/08
in the Search box. As soon as you do, you would instantly see all the files and folders created between those dates in the Results, as shown in Figure C.

Figure C

As soon as you type the Advanced Query Syntax search into the Search box, the results display instantly.
You can then narrow the search by selecting any of the filter buttons on the Show Only bar. For example, if you want to see only the documents, you would click the Document button, as shown in Figure D.

Figure D

You can then use the filter buttons on the Show Only bar to narrow the search.
If you then wanted to narrow the search down to just the .doc files, you could access the Advanced Search pane and type *.doc in the Name text box, as shown in Figure E. If you look back at the Search box, you'll notice that doing this is the same as adding the name property (name:*.doc) to the Advanced Query Syntax line.

Figure E

You can also use the options on the Advanced Search panel to narrow the search.

What's your take?

Have you used the Advanced Query Syntax for your searches in Vista? If so, what type of searches have you performed? Have you used Advanced Query Syntax in conjunction with Windows Search? If so, what type of searches have you performed? As always, if you have comments or information to share about this topic, please take a moment to drop by the TechRepublic Community Forums and let us hear from you.

TechRepublic's Windows Vista and Windows 7 Report newsletter, delivered every Friday, offers tips, news, and scuttlebutt on Vista and Windows 7, including a look at new features in the latest version of the Windows OS. Automatically sign up today!

About

Greg Shultz is a freelance Technical Writer. Previously, he has worked as Documentation Specialist in the software industry, a Technical Support Specialist in educational industry, and a Technical Journalist in the computer publishing industry.

Editor's Picks