dkirk Posted December 5, 2008 Share Posted December 5, 2008 Hello Gang, I am trying to run a batch file from a php file via a web browser but cannot get it to execute. This is part of an intranet application and I am pulling my hair out trying to get it to work. The code below should work but when I call the page throught IE nothing happens. Any ideas? <?php exec("SyncNow.bat"); ?> Link to comment https://forums.phpfreaks.com/topic/135706-trying-to-run-batch-file-from-browser/ Share on other sites More sharing options...
Maq Posted December 5, 2008 Share Posted December 5, 2008 echo exec("SyncNow.bat"); Link to comment https://forums.phpfreaks.com/topic/135706-trying-to-run-batch-file-from-browser/#findComment-707088 Share on other sites More sharing options...
dkirk Posted December 5, 2008 Author Share Posted December 5, 2008 Thanks for the response but I have already tried this. The only thing this does is to write what would be displayed in the command prompt window to the browser?? Link to comment https://forums.phpfreaks.com/topic/135706-trying-to-run-batch-file-from-browser/#findComment-707102 Share on other sites More sharing options...
Maq Posted December 5, 2008 Share Posted December 5, 2008 Sorry not too familiar with batch commands, have you tried system? system("SyncNow.bat"); Take a gander at this. Link to comment https://forums.phpfreaks.com/topic/135706-trying-to-run-batch-file-from-browser/#findComment-707109 Share on other sites More sharing options...
dkirk Posted December 5, 2008 Author Share Posted December 5, 2008 Hey no problem, I appreciate the help. I have already tried this as well Link to comment https://forums.phpfreaks.com/topic/135706-trying-to-run-batch-file-from-browser/#findComment-707113 Share on other sites More sharing options...
corbin Posted December 6, 2008 Share Posted December 6, 2008 Wait, you want the web browser to execute a batch script? I can think of a couple of ways to have it do that, but none of them would be easy. If browsers allowed execution of batch scripts, imagine all the security problems. lol. Link to comment https://forums.phpfreaks.com/topic/135706-trying-to-run-batch-file-from-browser/#findComment-707389 Share on other sites More sharing options...
pyrodude Posted December 6, 2008 Share Posted December 6, 2008 Yeah, I think we need some clarification. Do you want the batch file to be run on the server, or do you want the batch file run on the client's computer? Link to comment https://forums.phpfreaks.com/topic/135706-trying-to-run-batch-file-from-browser/#findComment-708060 Share on other sites More sharing options...
thecard Posted December 7, 2008 Share Posted December 7, 2008 Yeah...hope u realise that it would not be good to be able to run it in browser... Link to comment https://forums.phpfreaks.com/topic/135706-trying-to-run-batch-file-from-browser/#findComment-708137 Share on other sites More sharing options...
dkirk Posted December 8, 2008 Author Share Posted December 8, 2008 The batch file is to be run on the server. This is to be a part of a small companies intranet so the security aspect is not a concern. User's must login to this specific page and there is not but a few user's that will even be granted access. Link to comment https://forums.phpfreaks.com/topic/135706-trying-to-run-batch-file-from-browser/#findComment-709656 Share on other sites More sharing options...
dkirk Posted December 9, 2008 Author Share Posted December 9, 2008 I am basically trying to create a hyperlink that will launch a batch file. The batch file is used for file synchronization. Any help would be appreciated... Link to comment https://forums.phpfreaks.com/topic/135706-trying-to-run-batch-file-from-browser/#findComment-710503 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.