2
I’m making a manager for my online game so that team members can start the emulators.exe through the site, only I’m having a problem, the emulators opens in the background on the machine (VPS)
Then I wonder if you have how to make emulators run normally, opening the executable window and not getting in the background.
<?php
if($_POST['emulador'] == "Ligar")
{
exec("start D:\Servidor\Center\Gerenciador\ligar.bat");
echo "<script>alert('Emulador Ativado!');</script>";
}
?>
Content of bat.:
start /d "D:\Servidor 6.4\Servidor\Center" Center.Service.exe
@echo SERVIDOR FOI INICIADO ATRAVES DO SITE
@echo CMD IRA FECHAR EM 10 SEGUNDOS, AGUARDE E NAO INTERFIRA NO PROCESSO!
timeout 10
I was presented with this solution
if(!function_exists('pcntl_exec'))
{
function pcntl_exec($path,$args=array())
{
if(is_string($args)) $args = array($args);
if(count($args)) $path = sprintf('"%s"', $path);
$shell = new COM('WScript.Shell');
$shell->run($path.(count($args) ? ' '.implode(' ',$args) : ''),0,true);
}
}
switch ($_POST['Center'])
{
case "Ligar":
pcntl_exec('D:\\Servidor\\Center\\Gerenciador\\ligar.bat');
echo "<script>alert('Emulador Center Ativado!'); location.href='http://127.0.0.1/pt/?page=manager';</script>";
break;
}
however continues to open in the background, some idea ?
What do you mean, "foreground"?
– Jéf Bueno
I’m sorry about the way I express myself, I just want it to open as a normal window on the server like this cmd here http://prntscr.com/i1uyrx
– Julio
Please edit question and add your . bat content.
– Rafael Salomão
Conteudo do bat : start /d "D:\Servidor 6.4\Servidor\Center" Center.Service.exe
@echo SERVIDOR FOI INICIADO ATRAVES DO SITE
@echo CMD IRA FECHAR EM 10 SEGUNDOS, AGUARDE E NAO INTERFIRA NO PROCESSO!
timeout 10
– Julio
tries to change the
start /d
forcmd /c
– CypherPotato