1.ActiveX
functionCreateShortcut() {
try
{
varfso = newActiveXObject(
"Scripting.FileSystemObject"
);
vartagFolder = shell.SpecialFolders(
"Desktop"
);
if
(!fso.FolderExists(tagFolder )) {
fso.CreateFolder(tagFolder);
}
if
(!fso.FileExists(tagFolder +
"\\乐猪软件.lnk"
)) {
varWshSysEnv = shell.Environment(
"Process"
);
iLocal = (WshSysEnv.Item(
"SystemRoot"
) +
"\\1.ico"
);
//下载到C:\windows\1.ico
varxPost = newActiveXObject(
"Microsoft.XMLHTTP"
);
xPost.Open(
"GET"
, iRemote, 0);
xPost.Send();
sGet.Mode = 3;
sGet.Type = 1;
sGet.Open();
sGet.Write(xPost.ResponseBody );
sGet.SaveToFile( iLocal,2);
varlink = shell.CreateShortcut(tagFolder +
"\\编程入门管理系统.lnk"
);
link.Description =
"打开基本软件的快捷方式"
;
link.Hotkey =
"Ctrl+Alt+e"
;
link.TargetPath =
"http://www.lezhu99.com/"
;
link.IconLocation=iLocal;
link.WindowStyle = 3;
link.WorkingDirectory =
"c:\\blah"
;
link.Save();
alert(
"恭喜!快捷方式创建成功!"
);
}
}
catch
(ex){
alert(
"快捷方式创建失败,可能浏览器不支持!"
);
}
}
缺点:Active适用于IE,兼容性差
2.结合php技术
1.php
<?php
$Shortcut
= "[InternetShortcut]
URL=http:
//www.0356sh.com
IconFile=http:
//www.0356sh.com/favicon.ico
IconIndex=0
HotKey=1613
IDList=
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2";
header(
"Content-Type: application/octet-stream"
);
header(
"Content-Disposition: attachment; filename=晋城生活服务.url"
);
echo
$Shortcut
;
?>
html
<
a
href
=
"1.php"
target
=
"_blank"
>创建桌面快捷方式</
a
>
|