using (StreamWriter writer = new StreamWriter(deskDir + "\\" + name + ".url"))
{
writer.WriteLine("[InternetShortcut]");
writer.WriteLine("URL=" + url);//网址也可以是ftp地址
writer.WriteLine("ShowCommand=3");//浏览器打开的方式,0或者不设置是正常,3是最大,7是最小
writer.WriteLine("IconIndex=0");//ico的顺序,默认设置为0就可以
writer.WriteLine("IconFile=" + icoPath);//ICO路径,可以是dll、exe、ico等格式
writer.Flush();
}
创建好快捷方式后,如果不能显示正确的ICO,可以刷新一下桌面就可以了
由于我的英语很差,大家可以查看一下我从谷歌上找到的说明,有错误的地方,欢迎大家指正!
说明:
URL: This is self-explanatory. It is the url of the internet resource. Note this is not limited to the http protocol, it can be http, https, ftp or some other supported protocols。
ShowCommand: This the state the browser should be when the URL is opened. 0 or not setting this means normal, 3 means maximized, while 7 means minimized.
IconFile: This is the location of the file containing the icon that should be displayed for this file. This can be a .ico, .dll, .exe, or any file which can contain an icon file. Note that this is not limited to files on the local machine of the user, it can be on your webserver e.g. IconFile=http://www.example.com/myicon.ico
IconIndex: the index of the icon to use in the file specified in IconFile.