使用javascript创建快捷方式的简单实例_javascript技巧
时间:2021-07-01 10:21:17
帮助过:33人阅读
需将站点设为信任站点。
代码如下:
var fso = new ActiveXObject("Scripting.FileSystemObject");
var shell = new ActiveXObject("WScript.Shell");
var tagFolder = "c:\\Temp";
if(!fso.FolderExists(tagFolder ))
{
fso.CreateFolder(tagFolder);
//alert("Create success!");
}
if(!fso.FileExists(tagFolder + "\\eip.lnk"))
{
var link = shell.CreateShortcut(tagFolder + "\\eip.lnk");
link.Description = "打开一个程序的快捷方式";
link.TargetPath = "http://www.gxlcms.com";
link.WindowStyle = 3;
link.WorkingDirectory = "c:\\blah";
link.Save();
}