Create an Internet Shortcut Using Batch File

Q:  Is there a way to create a batch file which would put a desktop icon onto the desktop which invokes an HTML page in a web browser and change the associated icon for that particular desktop item, all in one batch file? Thanks

A: Yes. This is possible. Here are some examples:



echo [InternetShortcut] >"%userprofile%\desktop\localpage.url"
echo URL=C:\myfile.htm >>"%userprofile%\desktop\localpage.url"
echo IconFile=C:\icons\favicon.ico >>"%userprofile%\desktop\localpage.url"
echo IconIndex=0 >>"%userprofile%\desktop\localpage.url"
echo [InternetShortcut] >"%userprofile%\desktop\google.url"
echo URL=http://www.google.com/ >>"%userprofile%\desktop\google.url"
echo IconFile=e:\icons\google.ico  >>"%userprofile%\desktop\google.url"
echo IconIndex=0 >>"%userprofile%\desktop\google.url"

One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support, my reader. It won't take more than 10 seconds of your time. The share buttons are right below. :)

Ramesh Srinivasan is passionate about Microsoft technologies and he has been a consecutive ten-time recipient of the Microsoft Most Valuable Professional award in the Windows Shell/Desktop Experience category, from 2003 to 2012. He loves to troubleshoot and write about Windows. Ramesh founded Winhelponline.com in 2005.

2 thoughts on “Create an Internet Shortcut Using Batch File”

  1. How do I modify the url path on an existing internet shortcut? I have a .bat file that removes an existing shortcut and creates a new one, but the new shortcut has the old url.

  2. simply change the .bat file extension to .txt for editing.
    after finish editing, save and close it. then change the extension file back to .bat

    Run and done..

Comments are closed.