Below we have summarized two methods of using php and asp to create a shortcut code for the website on the user's desktop. If you need to learn, please refer.
| The Code is as follows: |
Copy code |
|
<%
Id = request ("id ")
Liehuo_net_url = request ("liehuo_net_url ")
If liehuo_net_url = "" Then liehuo_net_url = "pitfall tribe"
Export cut = "[InternetShortcut]" & vbCrLf
Export cut = export cut & "URL = http://www.hzhuti.com/" & vbCrLf
Export cut = Shortcut & "IDList =" & vbCrLf
Export cut = export cut & "IconFile = http://www.diaoxiong45.com/favicon.ico" & vbCrLf
Export cut = Shortcut & "IconIndex = 1" & vbCrLf
Export cut = export cut & "[{000214A0-0000-0000-C000-000000000046}]" & vbCrLf
Export cut = Shortcut & "Prop3 = 19,2" & vbCrLf
Export cut = Shortcut & "& vbCrLf
Response. AddHeader "Content-Disposition", "attachment; filename =" & liehuo_net_url & ". url ;"
Response. ContentType = "application/octet-stream"
Response. Write Shortcut
%> |
Asp.net
Provides a shortcut for saving webpage URLs and downloading code to the desktop
| The Code is as follows: |
Copy code |
|
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 is used for implementation. The method is similar to the above, but the code is different.
First, create a text file and copy the following code,
| The Code is as follows: |
Copy code |
<? 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 = mining tribe. url ;");
Echo $ Shortcut;
?> |
JShortcut. You need to download the library.
| The Code is as follows: |
Copy code |
|
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.
JShellLink link2 = new JShellLink ("C: \", "mhtest ");
Link2.load ();
String sPath = link2.getPath ();
System. out. print (sPath );
Int I = 0;
I ++;
}
}
|