Quick Web Searches from the Command Line

Learn how to quickly perform repetitive searches from the command line.

Readers

September 16, 2001

2 Min Read
ITPro Today logo in a gray background | ITPro Today

Editor's Note: Share your Windows 2000 and Windows NT discoveries, comments, problems, solutions, and experiences with products and reach out to other Windows 2000 Magazine readers (including Microsoft). Email your contributions (400 words or less) to [email protected]. Please include your phone number. We edit submissions for style, grammar, and length. If we print your submission, you'll get $100. Submissions and listings are available online at http://www.win2000mag.com/articles. Enter the InstantDoc ID number in the InstantDoc ID text box.

In Reader to Reader: "Whois on NT" (May 2001), Bill York provided a simple solution to address Windows NT's lack of a decent Whois command. To work around having to log on to a UNIX shell account or navigate through Network Solutions' Web site just to run a Whois command on your domain, he suggested that you type the following command into Notepad and save the file as whois.cmd:

@echo offstart http://www.netsol.com/cgi-bin/whois/whois?STRING=%1^&SearchType=do^&STRING2.x=14^&STRING2.y=11

This whois.cmd file lets you type

whois 

at a command line and automatically go to a Web page that provides the Whois command's statistics.

You can use the same technique to easily perform most repetitive searches from the command line. At least, you could if the command processor didn't directly parse symbols commonly used in HTTP addresses. The three common characters that cause problems are the ampersand (&), percent sign (%), and dollar sign ($). To work around this problem, you can insert a caret (^) in front of the special characters.

For example, if you go to the Windows 2000 Magazine Web site and search for Minasi, you end up at http://search.win2000mag.net/windows/query.html?col=windows&qt=Minasi. To use the workaround to search, first create the .cmd file. Simply open Notepad and type start followed by a copy of the previous URL. Replace the & with ^& and replace Minasi with %1 so that the modified command line is

start http://search.win2000mag.net/windows/query.html?col=windows^&qt=%1

Save this file (e.g., I saved it as w2kfind.cmd). Then, you can quickly check the Windows 2000 Magazine Web site for any one-word term simply by typing

w2kfind 

at a command prompt.

—Alex K. Angelopoulos
[email protected]

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like