View Full Version : Execute .bat from browser
Xselcer
10-11-2002, 05:53 PM
Is there a way to run a .bat file from a browser. Specifically I would like users to have the ability to trigger a .bat file from the browser. I would then like to be able to capture the output and use it. I have tried every PHP system command I know of (system(), exec(), passthru() and so on). I have also tried to make it happen with CGI using both perl and PHP. None of this seems to work. I even tried some JSCRIPT but security here will prevent Active X. BTW I am running PHP 4.0 / Apache 1.3 on WindowsXP. Any help would be greatly appreciated.
sedarious
10-12-2002, 01:27 AM
If you are trying to execute a .bat on the CLIENT's machine, php (or any other server side language) isn't going to be the thing to use. If you defined the problem a little more clearly it might help...
you will never be able to run any type of exe,bat,vb file from the browser. you will need to write a activex control, sign it then you can "run" this app from a browser to do what you need, that is if this will be on a windows OS....
iDxMan
10-13-2002, 11:41 AM
At work I've rigged up a perl thing which creates a dynamic .bat file then refreshes the page to the .bat url. The user then has to select `open` and let it run. (it fires up word/excel and downloads some stuff) But there isn't a way [in that method] to capture any output from the client.
-r
Originally posted by iDxMan
At work I've rigged up a perl thing which creates a dynamic .bat file then refreshes the page to the .bat url. The user then has to select `open` and let it run. (it fires up word/excel and downloads some stuff) But there isn't a way [in that method] to capture any output from the client.
-r
yah, the user would have to give the "browser" permission to execute it...hmmmm....capture the output, interesting.....lets see..
skidooer
11-01-2002, 01:46 PM
Originally posted by gish
yah, the user would have to give the "browser" permission to execute it...hmmmm....capture the output, interesting.....lets see..
That's not all that hard. Just have the batch file write the output to an HTML file, execute the HTML, and then it will submit the output back to the webserver.
Something like:
<html><body onload="f.submit()">
<form name="f" action="http://.../" method="post">
<textarea name="name">[Your output goes here]</textarea>
</form>
</body></html>
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.