hi all.
sorry for not writing in dutch. the reason I am in this forum is purely that I live in holland :-)
expecting some help from PHP experts.
started my first task in php.
1. i have a simple web application which must execute a .bat file.
2. when execution finished it shall display the results to users
i am using
xampp on windows 10.
the main issue is, due to system policy, i can only execute a .bat file in administrator mode.
Below code works:
=================
<?php
echo
exec('whoami');
exec('cd C:\softwares && dir >> temp.log');
//exec('dir');
$file = 'C:\softwares\temp.log';
$orig = file_get_contents($file);
$a = htmlentities($orig);
echo '<code>';
echo '<pre>';
echo $a;
echo '</pre>';
echo '</code>';
//echo file_get_contents( "c:\softwares\temp.log" );
?>
below code do not work :
========================
<?php
echo
exec('whoami');
exec('cd C:\softwares && testMyNameExists.bat >> temp.log');
//exec('dir');
$file = 'C:\softwares\temp.log';
$orig = file_get_contents($file);
$a = htmlentities($orig);
echo '<code>';
echo '<pre>';
echo $a;
echo '</pre>';
echo '</code>';
//echo file_get_contents( "c:\softwares\temp.log" );
?>
I understand that 'web user' should be run in Administrator mode. But i dont get which files has to be modified..
anyhelp is appreiciated. Thanks.
2.935 views