生活随笔
收集整理的這篇文章主要介紹了
js读取注册表然后打开指定程序
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
功能描述:
使用ie瀏覽器運(yùn)行該js文件,然后該js會(huì)讀取你電腦的注冊(cè)表,找見谷歌瀏覽器的安裝位置并運(yùn)行該軟件訪問js文件中的指定地址
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"><title>讀取google瀏覽器的注冊(cè)表</title></head><body><script type="text/javascript">function exec () { var command; var shell = new ActiveXObject("WScript.Shell"); try{//從注冊(cè)表獲得軟件安裝路徑 command = shell.RegRead("HKEY_CURRENT_USER\\Software\\Classes\\ChromeHTML.H52WNFPZZHK33RCEZBDOHZ4GUU\\Application\\ApplicationIcon");//只需要截取到 .exe 的字符串即可i = command.lastIndexOf(",")command = command.substring(0,i)alert(command)var dir = command.replace(/\\/g,"/")alert(dir)//運(yùn)行從配置表中讀取的軟件路徑,然后進(jìn)入指定頁面var cmd = "cmd /c start "+dir+" \"https://blog.csdn.net/qq_32657967";alert(cmd)var f = shell.Run(cmd,0); shell = null; }catch(e){if(window.confirm("你可能還沒有安裝Radiant,請(qǐng)下載安裝")){//alert("確定");window.location.href="jspView/radiantsetup32312921.exe";return false;}else{return false;}}//執(zhí)行exe程序window.oldOnError = window.onerror; window._command = command; window.onerror = function (err) { if (err.indexOf('utomation') != -1) { alert('命令' + window._command + ' 已經(jīng)被用戶禁止!'); return true; } else return false; }; window.onerror = window.oldOnError;} exec ()</script></body>
</html>
總結(jié)
以上是生活随笔為你收集整理的js读取注册表然后打开指定程序的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。