Thursday, October 30, 2008

System Command Line tools

There are some very handy tools that come with XP and Vista that are worth remembering next time you are at your friends house and they mention that they have broken their PC again....
Command-line reference A-Z

Today's CLI trick is : FindStr Searches for patterns of text in files using regular expressions.

I have all my Nokia phones numbers etc backed up onto my laptop in the windows .vcf format. Problem is its not quite the same as the windows format, so when you open them with windows address book you don't see all the info and each contact is in an individual file. Makes searching for a phone number by number really annoying, enter Findstr.

Open a command line at the folder were the files are that you want to search in (you have the Open Command Window here powertoy installed for XP yes ? in Vista you just hold down the shift key when right clicking a folder or drive and you get a limited command prompt, for an elevated (admin) prompt, look here or just download this .reg file and run it)

Once you are in the folder just type : Findstr stuffimlookingfor *.*
This will search all files (*.*) in the folder for the text "stuffimlookingfor".

You could always just install Total Commander , an excellent explorer replacement (that does ftp as well) that also does regular expression searches within files.

If you are like me and cant always remember a command line tools name, just go to C:\WINDOWS\system32 and search for all .exe files, this brings up all the CL tools available, there will be some non CL .exe files there too, but it should be enough to jog your memory.

Linux and OsX users can use grep to do the same thing.
$ grep stuffimlookingfor *

0 comments: