实现下载到桌面快捷方式程序代码
<%
id=request("id")
liehuo_net_url=request("liehuo_net_url")
If liehuo_net_url="" Then liehuo_net_url="挖坑部落"
Shortcut = "[InternetShortcut] " & vbCrLf
Shortcut = Shortcut & "URL=http://www.jiaochengji.com/" & vbCrLf
Shortcut = Shortcut & "IDList=" & vbCrLf
Shortcut = Shortcut & "IconFile=http://www.diaoxiong45.com/favicon.ico" & vbCrLf
Shortcut = Shortcut & "IconIndex=1" & vbCrLf
Shortcut = Shortcut & "[{000214A0-0000-0000-C000-000000000046}] " & vbCrLf
Shortcut = Shortcut & "Prop3=19,2 " & vbCrLf
Shortcut = Shortcut & " " & vbCrLf
Response.AddHeader "Content-Disposition", "attachment;filename="&liehuo_net_url&".url;"
Response.ContentType = "application/octet-stream"
Response.Write Shortcut
%>
asp.net
实现网页URL保存快捷方式,下载到桌面的代码
<table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy9535')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy9535>string websitename, string url
HttpContext.Current.Response.ContentType = "APPLICATION/OCTET-STREAM";
HttpContext.Current.Response.HeaderEncoding = System.Text.Encoding.UTF8;
var name = HttpContext.Current.Request.Browser.Browser.ToLower().IndexOf("firefox") >= 0 ? HttpUtility.HtmlEncode(websitename) : HttpUtility.UrlEncode(websitename);
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" name);
HttpContext.Current.Response.Write("[InternetShortcut]n");
HttpContext.Current.Response.Write("URL=" url "n");
HttpContext.Current.Response.Write("IDList=n");
HttpContext.Current.Response.Write("IconFile=/images/favicon.icon");
HttpContext.Current.Response.Write("IconIndex=1n");
HttpContext.Current.Response.Write("[{000214A0-0000-0000-C000-000000000046}]n");
HttpContext.Current.Response.Write("Prop3=19,2n");
HttpContext.Current.Response.Write("[DEFAULT]n");
HttpContext.Current.Response.Write("BASEURL=" url);
HttpContext.Current.Response.End();
php
用PHP来实现,方法跟上面差不多的,只是代码不同
先创建一个文本,把以下代码复制进去,
$Shortcut = "[InternetShortcut]
URL=http://www.diaoxiong45.com/
IDList=
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2
";
Header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=挖坑部落.url;");
echo $Shortcut;
?>
JShortcut,需下载库
<table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy1017')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy1017>http://alumnus.caltech.edu/~jimmc/jshortcut/
package com.test;
import net.jimmc.jshortcut.JShellLink;
public class TestS {
public static void main(String[] args) {
String jarFileName = "D:\mhtest";
// create lnk file
JShellLink link = new JShellLink();
link.setFolder("C:\");
link.setName("mhtest");
link.setPath(jarFileName);
link.save();
// get the real file the lnk file link to.
JShellLink link2 = new JShellLink("C:\", "mhtest");
link2.load();
String sPath = link2.getPath();
System.out.print(sPath);
int i = 0;
i ;
}
}
您可能感兴趣的文章:
Win8.1怎么把IE浏览器添加到桌面快捷方式
PHP创建桌面快捷方式实现代码
百度浏览器升级以后桌面快捷方式不能用了解决办法
php或asp创建网页桌面快捷方式
电脑显示桌面快捷方式不小心删除怎么办
Win10系统创建EDGE浏览器桌面快捷图标教程
ASP.NET控件利用Control.ContextMenu加入快捷菜单
添加网页桌面快捷方式的代码(js、asp、c#)
PhpStorm中返回上次编辑位置的快捷键使用方法
Windows 7系统桌面没有IE浏览器图标解决技巧