使用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 = "http://www.163.com";
                     link.WindowStyle = 3;
                     link.WorkingDirectory = "c:\\blah";            
                     link.Save();                     
                 }            
            
posted @ 2006-09-05 19:44  XiaoK  阅读(1127)  评论(6编辑  收藏  举报