exeoutput中的目录错误无效,但在浏览器中工作正常

I am trying to compile a PHP application using Exeoutput. The problem is with the following code:

$uniqueKey = shell_exec('wmic bios get serialnumber 2>&1');
$uniqueKey = str_replace('SerialNumber', '', $uniqueKey);

In browser (through XAMPP), output is perfect. It shows a serial key. But when I run this page under Exeoutput environment, I get the message:

The current directory is invalid.

Please help.