Using exec to run a .bat file showing console help

I run a small game server for that I use to record some game footage. I did not want to have to give direct access to my server since it is really not needed. I wrote 3 very simple .bat files that will start, restart, and shutdown the server process. I can run these just fine from the server when logged in directly and the console windows will show up. So I have written 3 very simple web pages that use these commands for my colleagues to run remotely. The problem is that when they are run from the pages using php the processes run in the background but function properly except no console windows. My question is can these be run using the php and still show the console windows?

Here is the restart page (the most commonly used command)

html>
 <head>
  <title>Restarting</title>
 </head>
 <body>
 <?php
exec("restart.bat"); 
window.close()
 ?> 

 </body>
</html>

Here is the batch file that kills the server process and restarts it. The ping is just to delay the next command until server process is running fully since it will fail if not.

taskkill /f /im arma2oaserver.exe
cd c:\dayz
@echo off
echo Starting server...
start .\Expansion\beta\arma2oaserver.exe -mod=Expansion\beta;Expansion\beta\expansion;ca;@hive;@dayz -name=cfgdayz -config=cfgdayz\server.cfg -cfg=cfgdayz\basic.cfg -profiles=cfgdayz
PING 1.1.1.1 -n 1 -w 60000 >NUL
cd c:\dayz\whitelist
start Whitelister.exe
exit

I guess I should tell you more about my system.

Windows Server 2012
Apache 2.2
PHP 5.4.0

Sponsor our Newsletter | Privacy Policy | Terms of Service