How Those %&% Characters Can Cause a Batch File URL to Fail

At the command line, you find that you can run a command that opens your favorite Web site, but when you put that command in a batch file, it fails. Find out what the problem is and how you can prevent it.

Karen Bemowski

March 10, 2008

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

At the command line, you find that you can run a command that opens your favorite Web site, but when you put that command in a batch file, it fails. What's going on? The command shell's treatment of certain characters commonly found in URLs, such as the percent sign (%) and the ampersand (&), can make batch files containing URLs fail, even though the commands work fine when you type or paste them after a command prompt. Learn why this problem occurs and how you can work around it in the article "Using URLs in Batch Files" by Alex K. Angelopoulos.

Alex also shows you how to write one-line batch files to open Web sites in which you regularly look up information. For example, he uses a batch file named winitpro to open up specific Windows IT Pro articles. To open the article "Using URLs in Batch Files," he just types the batch file's name followed by the article's InstantDoc ID:

winitpro 93483 

at the command line. Since you don't have this batch file yet, you can access the "Using URLs in Batch Files" article by going to www.windowsitpro.com/windowsscripting/article/articleid/93483/using-urls-in-batch-files.html. I've opened up this article for public viewing through April 3. If you enjoy reading this article, you can get more of this type of content by subscribing to Scripting Pro VIP.

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