.bat通过javascript代码调用 [英] .bat calling through javascript code

查看:105
本文介绍了.bat通过javascript代码调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过我的Java脚本代码调用.bat文件... bat文件又调用了Java文件..但是我在调​​用.bat文件plz帮助时遇到错误....它java类给出mi错误.... 这是代码仪式吗?

i m trying to call a .bat file through my java script code...the bat file in turns calls a java file..but i m facing an error with the calling of .bat file plz help....also it gives mi error with the java class.... is this code rite??

    <html> 
       <head> 
                 <script language="JavaScript" type="text/javascript">  
                 MyObject = new ActiveXObject( "WScript.Shell" )  
                 function Runbat()   
                 {  
                  MyObject.Run("C:\\Documents and        Settings\\shraddha\\Desktop\\test.bat") ;  
       }  

          </script> 
            </head> 
           <body> 
          <h1>Run a Program</h1> 
                    This script launch the file any bat File<p> 
            <button onclick="Runbat()">Run bat File</button> 
        </body> 
              </html> 

推荐答案

此处的代码格式正确.请注意,您的HTML缺少结尾的</p>标记和DOCTYPE.

Here is your code formatted properly. Note that your HTML is missing the closing </p> tag and DOCTYPE.

<html>
    <head>
        <script language="JavaScript" type="text/javascript">
            MyObject = new ActiveXObject("WScript.Shell")
            function Runbat()
            {
                MyObject.Run("\"C:\\Documents and Settings\\shraddha\\Desktop\\test.bat\"");
            }
        </script>
    </head>
    <body>
        <h1>Run a Program</h1>
        This script launch the file any bat File<p>
        <button onclick="Runbat()">Run bat File</button>
    </body>
</html>

有关您的HTML问题,请参见 http://validator.w3.org/.

See http://validator.w3.org/ for your HTML issues.

这篇关于.bat通过javascript代码调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆