Windows File Searching Made Faster, and Monitor Sleep Aids

4 minute read

Windows File Searching Made Faster

If you consider yourself fairly knowledgable about Windows, you might think that starting the Indexing Service to index the files on your hard drive would make doing a file search faster. Well, normally it doesn’t.

If you naively go to the “Search” button on your folder view or from the start menu, and then type in a filename in the “All or part of the filename:”, Windows is going to start cranking through your hard drive, looking over every file. It doesn’t matter that it’s already been indexed by the Indexing Service. It’s going to search stupidly anyway right at that moment.

On the other hand, if you type a special search query into the box marked “A word or phrase in the file:”, Windows will instantaneously give your results, because it will use the Indexing Service. For instance, if you type the following in that blank with your C: drive selected:

@filename *.txt

In the blink of an eye you will get a list of every text file on your C: drive. If you try that the old way, in the “All or part of the filename” blank, you’ll be in for a long wait, and a lot of disk thrashing.

Similarly, if you type the following in the “word or phrase” blank:

!good

In another blink of an eye it will find all files that contain the word “good”.

I couldn’t find the definitive guide to this query language from Microsoft, only much more complicated references. But there are many pages on the net involving a page name of “ixqlang”, which are probably copied from some original Microsoft source. Here’s one such copy.

Using the “@” identifies a property of the file you’re looking for. Some examples:

@size > 10000

@write < 2004/10/01

@filename *.txt & @size > 10000

Those past three examples look for a.) anything bigger than 10,000 bytes, b.) anything modified before October 2004, and c.) any text file bigger than 10,000 bytes. More detail can be found in the ixqlang references.

Apparently, the new MSN Desktop Search Bar is just a fancy user interface to this pre-existing functionality that Microsoft saw fit to deprive us of for so long.

Monitor, to sleep! Now!

If you have a laptop or a flat screen monitor, it can be vexing that sometimes Windows just doesn’t put your monitor into power-save mode even if you tell it to do so after a certain amount of inactivity. With an LCD screen, you’re wasting precious life of your backlight. It doesn’t matter if what’s being displayed is black, the backlight is still on unless your monitor is in “Suspend” mode. For a laptop, your power is being used unnecessarily.

I’ve seen a couple of people who have interfaced the windows screen-saver mechanism, which always seems to work, to the activation of Suspend mode. One such person offering a free solution is this guy. He offers a screen saver that will put your laptop screen into power-save mode, turning off the backlight, instead of just painting pretty picutures. Great.

An even better side benefit is that he offers a program, monsus.exe, that will suspend your monitor when it is run. We can use this to create a keystroke way of instantly turning off your monitor (if your laptop manufacturer hasn’t already been nice enough to give you this capability.)

First, copy monsus.exe into C:\WINDOWS or C:\WINNT, whichever exists on your system. Then, create the following batch file:

@echo off

rem wait one second
ping 1.1.1.1 -n 1 -w 1000 >NUL

rem now suspend the monitor
monsus 2

(Why did I use “ping”?)

Just make a text file with the above text, and then name it monitoroff.bat. Put that also in C:\WINDOWS or C:\WINNT depending on your system.

Now I’m not sure if you need to logout to make sure those files are in your path, but I think you do. So logout and login again.

Now, open up C:\WINDOWS or C:\WINNT, find the monitoroff.bat file, and drag it to your Start Menu, to some subdirectory where it will be out of the way, but you know where to find it. This will create a shortcut to monitoroff.bat in your Start Menu. Once it is created, go to that shortcut in your Start Menu, and right-click on it, and select “Properties”. You’ll see a blank for a “Shortcut key”. Type in some key (Not ESC, Enter, TAB, PrintScreen, SPACEBAR, DELETE, or BACKSPACE) and you will notice that Windows adds a “Ctrl+Alt+” before it. Whatever key you put in this blank is now the hotkey to activate monitoroff.bat. Press OK, to finish editing the properties.

Now, by pressing Ctrl+Alt+, you run monitoroff.bat at any time, no matter which program is focused. It will wait one second, and then turn off your monitor. Voila!

The reason I wait one second, is that if the monitor gets disabled, then releasing the Ctrl and Alt keys will be interpreted as a keyup event and turn the monitor back on. You can release the Ctrl and Alt keys very quickly to try and get around this, but then when your computer wakes up, it won’t know that the Ctrl and Alt keys have ever been released, and think that they are still down, which will be confusing to you.

You can also do this trick with the hotkeys for any program in your Start Menu. It’s a very quick way to start any program.

Updated: