首页 > 编程 > JavaScript > 正文

使用javascript创建快捷方式的简单实例

2019-11-20 22:25:48
字体:
来源:转载
供稿:网友
需将站点设为信任站点。
复制代码 代码如下:

             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 = "//www.VeVB.COm";
                     link.WindowStyle = 3;
                     link.WorkingDirectory = "c://blah";           
                     link.Save();                     
                 }            
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表