javascript创建桌面快捷方式

郭文睿 2011-12-07

<scriptlanguage="JavaScript">

functiontoDesktop(sUrl,sName){

try

{

varWshShell=newActiveXObject("WScript.Shell");

varoUrlLink=WshShell.CreateShortcut(WshShell.SpecialFolders("Desktop")+"\\"+sName+".url");

oUrlLink.TargetPath=sUrl;

oUrlLink.Save();

}

catch(e)

{

alert("当前IE安全级别不允许操作!请设置后在操作.");

}

}

</script>

<inputname="btn"type="button"id="btn"value="创建建站学在桌面的快捷方式"onClick="toDesktop('http:\//www.jzxue.com/','建站学')">

<inputname="btn"type="button"id="btn"value="创建C盘"onClick="toDesktop('file:\//C:','C盘')">

相关推荐