Subscribe to Windows IT Pro
September 17, 2001 12:00 AM

Quick Web Searches from the Command Line

Windows IT Pro
InstantDoc ID #22197
Rating: (0)

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 r2r@win2000mag.com. 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 off

start 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 <searchterm>

at a command prompt.

Related Content:

ARTICLE TOOLS

Comments
  • Alex K. Angelopoulos
    10 years ago
    Jan 18, 2002




    Windows XP has a built-in Whois command, so if you use the updated script (which returns "extended" Whois query data), give it a different name (e.g., whoisx.cmd) to prevent name collisions.


    Alex K. Angelopoulos

  • Gary Stadter
    10 years ago
    Jan 18, 2002




    Whois Update

    In Reader to Reader: "Quick Web Searches from the Command Line" (October 2001), Alex K. Angelopoulos refers to Bill York's whois.cmd file, which solves the problem of Windows NT's lack of a Whois command. Network Solutions has merged with VeriSign, and the whois.cmd file that the article includes is now obsolete. Can you provide an update?


    Gary Stadter



    Network Solutions has a new domain name and search syntax. Here's a version of whois.cmd that works now, but be aware that this version might become outdated if the company makes other modifications to the site:


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

  • Alex Angelpoulos
    11 years ago
    Oct 24, 2001

    Since XP has a built-in command-line whois, it would probably be a good idea to suggest a different name for the script to prevent "name collisions" - possibly "whoisx.cmd" since the returned information is "eXtended" beyond the standard "whois" query data.

  • Alex Angelopoulos
    11 years ago
    Oct 01, 2001

    Updated Whois (this will wrap):
    start http://www.netsol.com/cgi-bin/whois/whois?STRING=%1^&SearchType=do^&STRING2.x=14^&STRING2.y=11

    This may go stale if they do any further modificiatins to their site.

  • Alex Angelopoulos
    11 years ago
    Sep 26, 2001

    As shown ine, the actual search term argument was left off the last line.
    So, to search for "Minasi" articles, you would type:
    w2kfind Minasi

    Should be obvious.

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.