andytan91 Posted July 14, 2010 Share Posted July 14, 2010 Hi guys, basically my current situation is that the client will need to run the audit services batch file from the web server. My problem is that although the code below executed successfully, the .bat batch file outputs the result of the server's side computer configuration. I would like it to output the service result of the client side because i want to audit the client side and not the web server side. How do i go about doing that? <?php echo exec('cmd /c 4.1_services.bat'); ?> Contents of batch file @echo off sc qc Alerter | findstr "START_TYPE DISPLAY_NAME" >>hi.txt sc qc wuauserv | findstr "START_TYPE DISPLAY_NAME" >>hi.txt sc qc BITS| findstr "START_TYPE DISPLAY_NAME" >>hi.txt sc qc Clipsrv | findstr "START_TYPE DISPLAY_NAME" >>hi.txt sc qc Browser | findstr "START_TYPE DISPLAY_NAME" >>hi.txt sc qc Fax | findstr "START_TYPE DISPLAY_NAME" >>hi.txt sc qc IISADMIN | findstr "START_TYPE DISPLAY_NAME" >>hi.txt sc qc ciSvc | findstr "START_TYPE DISPLAY_NAME" >>hi.txt sc qc Messenger | findstr "START_TYPE DISPLAY_NAME" >>hi.txt sc qc Netlogon | findstr "START_TYPE DISPLAY_NAME" >>hi.txt sc qc mnmsrvc| findstr "START_TYPE DISPLAY_NAME" >>hi.txt sc qc RDSessMgr| findstr "START_TYPE DISPLAY_NAME" >>hi.txt sc qc RemoteRegistry | findstr "START_TYPE DISPLAY_NAME" >>hi.txt sc qc RemoteAccess| findstr "START_TYPE DISPLAY_NAME" >>hi.txt sc qc SMTPSVC | findstr "START_TYPE DISPLAY_NAME" >>hi.txt sc qc SNMP | findstr "START_TYPE DISPLAY_NAME" >>hi.txt sc qc SNMPTRAP | findstr "START_TYPE DISPLAY_NAME" >>hi.txt sc qc Schedule | findstr "START_TYPE DISPLAY_NAME" >>hi.txt sc qc TlntSvr | findstr "START_TYPE DISPLAY_NAME" >>hi.txt sc qc TermService| findstr "START_TYPE DISPLAY_NAME" >>hi.txt sc qc upnphost| findstr "START_TYPE DISPLAY_NAME" >>hi.txt sc qc w3svc | findstr "START_TYPE DISPLAY_NAME" >>hi.txt Quote Link to comment https://forums.phpfreaks.com/topic/207706-running-batch-file-on-client-side/ Share on other sites More sharing options...
andytan91 Posted July 14, 2010 Author Share Posted July 14, 2010 Actually i have another method which is using Force Downloading but however, my project requires me to auto run the batch file when the user saves the script....how do i go about doing that? <?PHP // Define the path to file $file = '4.4_File_Permission.bat'; if(!file) { // File doesn't exist, output error die('file not found'); } else { // Set headers header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename=$file"); header("Content-Type: application/bat"); header("Content-Transfer-Encoding: ASCII"); // Read the file from disk readfile($file); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/207706-running-batch-file-on-client-side/#findComment-1085797 Share on other sites More sharing options...
trq Posted July 14, 2010 Share Posted July 14, 2010 How do i go about doing that? Cannot be done with php. You would need to use either a Java applet, or an ActiveX control of some sort. PHP runs on the server. Quote Link to comment https://forums.phpfreaks.com/topic/207706-running-batch-file-on-client-side/#findComment-1085798 Share on other sites More sharing options...
andytan91 Posted July 14, 2010 Author Share Posted July 14, 2010 Thanks a lot. I will look it up. Quote Link to comment https://forums.phpfreaks.com/topic/207706-running-batch-file-on-client-side/#findComment-1085811 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.