Creating a web shortcut on user desktop programmatically

霸气de小男生 提交于 2019-12-07 12:03:34

问题


There are quite a few resources for programmatically creating .lnk type shortcuts to files and programs on the desktop but I'm wondering how to create a shortcut to a web URL.

From what I can gather, the web URL shortcut is a text file ending in .URL and contains a ini-like definition such as:

[InternetShortcut]
URL=http://www.google.com/

However, it's not enough to just create the file, it seems you also need to change its meta URL properties to include the same link.

Any idea how to create these?

Any sample code from .Net/Perl/batch is welcome.


回答1:


You can create .lnk shortcuts to any URI, including web addresses. Just create the shortcut and make the target your web address instead of a file location.

See this other question for how to do it programmatically:

Creating application shortcut in a directory



来源:https://stackoverflow.com/questions/539962/creating-a-web-shortcut-on-user-desktop-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!