使用javascript创建快捷方式的简单实例
时间:2020-12-08 23:26:42|栏目:JavaScript代码|点击: 次
需将站点设为信任站点。
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 = "https://www.jb51.net";
link.WindowStyle = 3;
link.WorkingDirectory = "c:\\blah";
link.Save();
}
复制代码 代码如下:
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 = "https://www.jb51.net";
link.WindowStyle = 3;
link.WorkingDirectory = "c:\\blah";
link.Save();
}
上一篇:Web 开发中Ajax的Session 超时处理方法
栏 目:JavaScript代码
下一篇:JavaScript实现省市联动过程中bug的解决方法
本文地址:http://www.codeinn.net/misctech/30770.html