Jump to content
Sign in to follow this  
t0ze

[Resolvido] Executar tarefa windows via shell_exec

Recommended Posts

t0ze

Boa tarde,

Tenho este pedaço de código:

$cmd = escapeshellcmd('schtasks /Run /TN "TRS\TRSActivity"');
$sheelActivity = shell_exec($cmd);
$cmd = escapeshellcmd('schtasks /Run /TN "TRS\TRSCrew"');
$sheelCrew = shell_exec($cmd);

Acontece que quando corre no php, não faz nada. Já corri o schtasks /Run /TN "TRS\TRSCrew" na linha de comandos e faz o pretendido.

A tarefa está programada para correr com o IIS_IUSRS.. Alguma idéia?

Share this post


Link to post
Share on other sites
HappyHippyHippo

http://us3.php.net/escapeshellcmd

o exemplo dado é com system(), mas podes ainda ter algo muito mais simples:

$cmd = escapeshellcmd('schtasks /Run /TN "TRS\TRSActivity"');
$sheelActivity = `$cmd`;
$cmd = escapeshellcmd('schtasks /Run /TN "TRS\TRSCrew"');
$sheelCrew = `$cmd`;

se mesmo assim continuas com erros, verifica o log de erros do teu servidor

  • Vote 1

IRC : sim, é algo que ainda existe >> #p@p

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.