zoukankan      html  css  js  c++  java
  • js调用本地程序


    <html>
    <head>
    <title></title>
    <script type="text/javascript">
    function exec(command)
    {  
      window.oldOnError 
    = window.onerror;
      window._command 
    = command;
      window.onerror 
    = function (err) {
                              
    if (err.indexOf('utomation'!= -1)
                              {
                                alert(
    '命令' + window._command + ' 已经被用户禁止!');
                                
    return true;
                              }
                              
    else
                                
    return false;
                            };
      
    //-----------
      var wsh = new ActiveXObject('WScript.Shell');
      
    if (wsh) wsh.Run(command);
      wsh 
    = null;
      window.onerror 
    = window.oldOnError;
    }
    </script>
    </script>
    </head>
    <body>
    <input type="button" value="执行" onclick="exec('notepad.exe')" />
    </body>
    </html> 

    自己写了一个.net程序测试,开始是设置环境变量,结果不行,然后拷到C:\windows目录,结果就OK了。这说明,
    1、如果要自己写一个C#程序,则必须把安装在C盘的Windows目录,
    2、点击时会有个是否的提示。就看你是否能忍受了。
    3、能否执行与IE权限还有很大关系。

  • 相关阅读:
    [ASP.NET Core] Tips
    Integration_Unit test coding standard
    集成测试报错的解决方案
    Integration testing
    Web Cache
    BIT
    CSU 1449: A+B and C
    [转] CUDA + code::blocks 配置
    CF 245 div2
    NBUT 2014 C Lord of Minecraft
  • 原文地址:https://www.cnblogs.com/yvesliao/p/1579518.html
Copyright © 2011-2022 走看看