Batch files provide advantages over using desktop shortcuts or browser favorites to connect to frequently used Web sites. You can launch sites without needing to hunt down the page in your favorites list and even use command-line arguments to retrieve specific content much more quickly. If you put the batch files in a common tools directory on the network, you can access them from any machine, even if you're logged on as another user. However, the command shell's treatment of certain common URL characters, such as the percent sign (%), can make batch files containing URLs fail, even though the commands you use will work fine if you type or paste them at a command prompt. When you understand why this problem occurs, you can work around it, and I'll show you how by using a couple of Google and Microsoft Knowledge Base lookups as examples.
Performing a Google Phrase Search
The situations in which I usually see this problem involve extremely long Internet URLs, frequently for reference pages in online specialty sites; however, the problems are the same as you'd encounter with a simple Google phrase search. For example, if you look up the phrase parent process on Google, the URL at the top of the results page will be http://www.google.com/search?q=%22parent+process%22. The Windows command shell can't understand commands that begin with protocol handlers such as "http://", but if you invoke the URL with cmd.exe's Start command, the URL will automatically be passed to the default Web browser. For example, entering the following text at a command prompt
Start http://www.google.com/
search?q=%22parent+
process%22
opens your Web browser and passes the page request to Google. (Although this command appears on several lines here, you would enter it on one line in the command-shell window. The same holds true for the other multiline commands in this article.) So far, so good. . . .