Connecting Tech Pros Worldwide Help | Site Map

Run a local executable from php

Newbie
 
Join Date: Aug 2006
Posts: 2
#1: Aug 9 '06
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
Newbie
 
Join Date: Aug 2006
Posts: 2
#2: Aug 9 '06

re: Run a local executable from php


Quote:

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\\system32\\cmd.exe /K c:\\sample.bat ",1,true);
}
</script>
</head>
<body onload='proc();'>
</body>
</html>


It is saved as stafe.hta
ronverdonk's Avatar
Moderator
 
Join Date: Jul 2006
Location: The Netherlands
Posts: 4,139
#3: Aug 9 '06

re: Run a local executable from php


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:
Reply