Iris Classon
Iris Classon - In Love with Code

Advanced searching with Windows 8 Search

Yesterday while on a call with one of my favorite people I had the opportunity of sharing a nifty little thing everybody should know in Windows 8. This is not specific to Windows 8- but it sure is easier to do a search now. We will start of easy with simple file filtering, before we look at conditional searching (using AND, NOT, OR), and comparing that with PowerShell power.

Filter on type

While in the Modern UI mode if you start typing Search will show up, and you can search. Windows Key and Q will do the same (think Q for ‘Query’). You probably knew that. You probably also knew that you can expand the dropdown menu and filter on type.

clip_image001

But, did you know the following? :

Get all the results

You only will see a selection of the result- matched on best matching. If you have ‘Everywhere’ you will most likely only see two results on files. If you hit enter, and let the smart search app open, you will see *all* results. Rather handy when you are looking for a file.

clip_image002

Search with file extensions filter

Simply add .extension to the search. Say for example that I’m looking for my resume, and I know it’s a .pdf I want, I’ll search for “cv .pdf”

clip_image003

Conditional searching

Let’s get a bit more fancy, shall we? Say I’m looking for my resume, and as you can see I have many versions. I want to find a file that has CV in the name and 2013, I do however not want any files that are words documents or .txt.

For this we use AND, NOT and OR and the query can look like this:

CV AND 2013 NOT (.docx OR .txt)

clip_image004

clip_image005

Using PowerShell for *real* advanced searches

I couldn’t help myself, I had to add how to do searches in PowerShell. I’m not a pro on this, so I’m sure these lines can be improved. With PowerShell can search exactly as you want to, and include and filter just as you please.

clip_image007

The lines above goes recursively through all directories under my user catalog grabbing all files that have CV in them (notice wildcard before and after).

The items are then piped and we grab the items that have the same date, or a newer date (-ge) as well as has the .pdf extension.

You can do so much more, but this is not a PowerShell post, so I’ll save that for another time.

$items = Get-ChildItem -Path C:\Users\IrisDaniela -Recurse -Include @("*CV*")

$items | Where-Object { $_.CreationTime -ge “01/01/2013” -and $_.Extension -eq “.pdf”}

Comments

Leave a comment below, or by email.


Last modified on 2014-02-22

comments powered by Disqus