php and batch files
-
Hi, I want a PHP script to run multiple batch files. The batch files are doing the same job but for different files. I don't want to create several scripts to do the same job. Any idea is welcome.
-
Hi, I want a PHP script to run multiple batch files. The batch files are doing the same job but for different files. I don't want to create several scripts to do the same job. Any idea is welcome.
Not knowing exactly what task or tasks you wish to batch perform, and not being a mind reader, may I suggest you visit web sites such as http://www.hotscripts.com/category/php/[^] and look to see if anything there (or elsewhere for that matters) jumps up and says "try me"!
-
Not knowing exactly what task or tasks you wish to batch perform, and not being a mind reader, may I suggest you visit web sites such as http://www.hotscripts.com/category/php/[^] and look to see if anything there (or elsewhere for that matters) jumps up and says "try me"!
The script is as shown below
<?php
session_start();
$userid=$_SESSION['userid'];
$res=exec('bat\diff_coursework.bat',$shell);
echo '<a href="content/differentiation_coursework/main.pdf"><input name="Download" type="button" value="Download" />';
include ("config.php");
$query="insert into access values('$userid','differentiation','coursework',NOW())";
mysql_query($query);
?>It calls the batch file diff_coursework.bat and then display a download button for the main.pdf file. I have several files to be run the same way therefore I need a general script for that instead of creating a new script for every file.
-
The script is as shown below
<?php
session_start();
$userid=$_SESSION['userid'];
$res=exec('bat\diff_coursework.bat',$shell);
echo '<a href="content/differentiation_coursework/main.pdf"><input name="Download" type="button" value="Download" />';
include ("config.php");
$query="insert into access values('$userid','differentiation','coursework',NOW())";
mysql_query($query);
?>It calls the batch file diff_coursework.bat and then display a download button for the main.pdf file. I have several files to be run the same way therefore I need a general script for that instead of creating a new script for every file.
since this part is just a string being passed 'bat\diff_coursework.bat' maybe an array might help $bats_arr = array('diff_coursework.bat','diff_coursework2.bat','diff_coursework3.bat', etc....); foreach($bats_arr as $bat_file) { $res=exec('bat\'.$bat_file,$shell); }
-
since this part is just a string being passed 'bat\diff_coursework.bat' maybe an array might help $bats_arr = array('diff_coursework.bat','diff_coursework2.bat','diff_coursework3.bat', etc....); foreach($bats_arr as $bat_file) { $res=exec('bat\'.$bat_file,$shell); }
Have you tried to implement this? This will run all the bat files every time it is called. I want it to be able select the bat files to run. Thanks for the idea
-
Have you tried to implement this? This will run all the bat files every time it is called. I want it to be able select the bat files to run. Thanks for the idea