Javascript calls the active file

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns=" http://www.w3.org/1999/xhtml ">
<head>
    <title></title>
    <script type="text/javascript">
        function Run(strPath) {
            txtExe.value = strPath;
            try {
                var objShell = new ActiveXObject("wscript.shell");
                objShell.Run(strPath);
                objShell = null;
            }
            catch (e) {
                alert('找不到文件"'+ StrPath + ' "(or one of its components). Make sure the path and file name are correct and that all required libraries are available.')
            }
        } 
    </script>
</head>
<body>
    请输入要运行的程序:<br>
    <input name="txtExe" type="text" size="20" value="regedit">
    <button type="button" onclick="Run(txtExe.value)">
        确定</button>
    <button type="button" onclick="txtExe.value=''">
        重新输入</button><br>
    <button type="button" onclick="Run('C:\\WINDOWS\\system32\\otepad.exe')">
        记事本</button><br>
    <button type="button" onclick="Run('C:\\WINDOWS\\system32\\mspaint.exe')">
        画图板</button><br>
    <button type="button" onclick="Run('C:\\WINDOWS\\system32\\calc.exe')">
        计算器</button><br>
    <button type="button" onclick="Run('C:\\WINDOWS\\system32\\cmd.exe')">
        cmd</button><br>
    <button type="button" onclick="Run('C:\\WINDOWS\\egedit.exe')">
        注册表</button><br>
    <button type="button" onclick="Run('C:\\WINDOWS\\PCHealth\\HelpCtr\\Binaries\\msconfig.exe')">
        Msconfig</button><br>
</body>
</html>

Reproduced in: https: //www.cnblogs.com/zhangchenliang/archive/2010/08/03/1791118.html

Guess you like

Origin blog.csdn.net/weixin_33806509/article/details/93496040
Recommended