Run a local executable from php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cervantis_wants
    New Member
    • Aug 2006
    • 2

    #1

    Run a local executable from php

    Hi

    I am having a open source tool called STAF where i have to run the commands for this application through a command prompt like cmd. I have used the following code to run it and saved it as a .hta file . It works fine in IE ,but in Firefox as soon as i click the link for executing this .hta file , it shows up the entire source code on the page.

    I would like to know whether can we run .hta in firefox and if so , how ? and
    Is there any way where we can open cmd.exe from browser in php passing parameters to it.

    Thanks for the help in Advance

    Cervantis
  • cervantis_wants
    New Member
    • Aug 2006
    • 2

    #2
    Originally posted by cervantis_wants
    Hi

    I am having a open source tool called STAF where i have to run the commands for this application through a command prompt like cmd. I have used the following code to run it and saved it as a .hta file . It works fine in IE ,but in Firefox as soon as i click the link for executing this .hta file , it shows up the entire source code on the page.

    I would like to know whether can we run .hta in firefox and if so , how ? and
    Is there any way where we can open cmd.exe from browser in php passing parameters to it.

    Thanks for the help in Advance

    Cervantis

    This is the code which i missed out sending in the previous post:

    <html>
    <head>
    <script type="text/javascript">
    function proc()
    {
    var shell = new ActiveXObject(" WScript.Shell") ;
    shell.Run("c:\\ windows\\system 32\\cmd.exe /K c:\\sample.bat ",1,true);
    }
    </script>
    </head>
    <body onload='proc(); '>
    </body>
    </html>


    It is saved as stafe.hta

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      Have you ever considered using the standard PHP commands EXEC() or SYSTEM()? See PHP documentation for details:http://nl2.php.net/manual/en/ref.exec.php

      Ronald :cool:

      Comment

      Working...