美文网首页liangzhici 技术整理
使用JavaScript执行CMD,并打开谷歌Chrome

使用JavaScript执行CMD,并打开谷歌Chrome

作者: liangzhici | 来源:发表于2019-12-17 11:17 被阅读0次

* 仅支持IE

复制新建html使用IE打开即可

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>@liangzhici</title>
</head>
<body>
<button onclick="runcmd()"><h1>使用谷歌打开百度(cmd)</h1></button>
<script>
function runcmd(){
        var cmd = new ActiveXObject("WScript.Shell");
        cmd.run("cmd.exe /c start chrome https://www.baidu.com", 0) //0 不显示cmd窗口
        cmd = null;
    }   
</script>
</body>
</html>

相关文章

网友评论

    本文标题:使用JavaScript执行CMD,并打开谷歌Chrome

    本文链接:https://www.haomeiwen.com/subject/kxlsnctx.html