0

This is important for me as I have a PRN file which can be printed only through command prompt. And I want to delete that file after the print command is given.

So these 2 commands can be executed using batch file only.

And when I try to use activexobject in javascript, my firefox browsers doesnt run it.

<script>
MyObject = new ActiveXObject("WScript.Shell");
function Runbat()
{
MyObject.Run("\"D:\\abc.bat\"");
}
</script>
Vivek
  • 45
  • 1
  • 1
  • 8

1 Answers1

0

Together in a html page.

I've found this one and it seems working properly :)

<html>
    <head>
        <script language="JavaScript" type="text/javascript">
            MyObject = new ActiveXObject("WScript.Shell")
            function Runbat()
            {
                MyObject.Run("\"D:\\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>

Now I don't really know if you are already working with exaclty that solution, if so, and you are still facing this issue in firefox you may need to investigate a little bit more in browser security to know if that is even possible as of this post states that:

No, that would be a huge security breach. Imagine if someone could run

format c:

whenever you visted their website.

Community
  • 1
  • 1
Luca
  • 1,766
  • 3
  • 27
  • 38
  • Yes, I understand your point about security breach. But I am going to provide this to just 1 person that also for his own admin panel. It;s nit going to public. Any guidance why this is not working for Mozilla? – Vivek Jan 20 '15 at 12:29
  • @Vivek "You mean launch an external program thru a browser window using JavaScript? No way you can do that! That's a goddamn security black hole!" So you would need to start configuring Mozilla Server-Sided and that (I think) is not possible for you. – Luca Jan 20 '15 at 12:34