sw0o0sh Posted June 9, 2007 Share Posted June 9, 2007 Hi, passthru() seems to not be working anymore for this, but this is what I need done... I need to be able to make the user be able to click a button, which then launches a batch file on my computer.. But passthru() doesnt do the job anymore. And is faulty.. My computer is the server, so it'd also be nice if the command could launch it in a windowed form instead of a background process :-\ Here's my code. <?PHP if($_POST['shutdown']){ $command = 'cmd\stop.bat'; passthru($command); } else if($_POST['on']){ $command = '..\..\GSV001\run.bat'; passthru($command); } ?> <form method='post'> <input type='submit' name='shutdown' value='Shutdown' /> <input type='submit' name='on' value='Turn On' /> </form> "On", for example.. Launches a CMD but the server never turns on. Here's the batch content within it: @echo off ant run pause But yeah, that's basically it. Is there any function in PHP that works better than passthru()? Quote Link to comment https://forums.phpfreaks.com/topic/54891-executing-a-program-remotely-with-php/ Share on other sites More sharing options...
chigley Posted June 9, 2007 Share Posted June 9, 2007 exec() maybe? Quote Link to comment https://forums.phpfreaks.com/topic/54891-executing-a-program-remotely-with-php/#findComment-271468 Share on other sites More sharing options...
sw0o0sh Posted June 9, 2007 Author Share Posted June 9, 2007 Nah didnt do anything. Quote Link to comment https://forums.phpfreaks.com/topic/54891-executing-a-program-remotely-with-php/#findComment-271472 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.