can't execute .bat file from php

We have a web portal in a WIMP environment. There is a web page that users can fill out a form. When the form submits I need it to create and execute a batch file on the server that is in a folder outside the wwwroot folder.

What happens is the user submits the form & the php is able to create the .bat file in c:/scripts/labor/scheduled/labor_repost.bat, no problem. The contents of the batch file is a single line that looks like:

c:\scripts\labor\scheduled\cscript.exe c:\scripts\labor\scheduled\labor.vbs /store_list:"store1;store2" /start_date:"2013-01-21" /end_date:"2013-01-24"

If I execute the .bat file from the command line manually it works perfectly.

The cscript.exe, labor.vbs, and labor_repost.bat files are all in the same folder. In testing, I’ve tried setting permissions on all these files and the folder they’re in to allow these users full control:

Authenticated Users

However, nothing I try from PHP is able to execute the .bat file. I have tried:

[php]exec(‘c:/scripts/labor/scheduled/labor_repost.bat’, $out, $retval);
$out = shell_exec(‘c:/scripts/labor/scheduled/labor_repost.bat’);

$ws = new COM(‘WScript.Shell’);
$w = $ws->Run(‘c:/scripts/labor/scheduled/labor_repost.bat’, 0, false);[/php]

I’ve also tried various other combinations of this by including “psexec” and “cmd /c”.

None of these will execute the batch file - no matter which one I try, nothing happens. If I echo back the return value from the batch file, it will just echo back the contents of the file. I don’t get any error messages.

Is it possible that it’s a permissions issue? If so, what would need permission to what?

We checked the antivirus logs and it doesn’t appear to be that.

Please help. Thank you!

Sponsor our Newsletter | Privacy Policy | Terms of Service