title: PHP exec on windows - php cwd is a Windows Network Share
body: <p>this is my first post and I would like to apologise in advance in case it's not worded or structured in the best way.</p>
  
  <p>I am using Windows7 Home Premium with IIS 7.5 and PHP 5.3
  I am executing the following code in php and it doesn't work. The exec command returns 1 and an empty array.</p>
  
  <pre><code>$path = "\\\\somecomputer\\somepath\\afolder";
  chdir($path);
  $cmd = "pushd $path";
  exec("echo off &amp; $cmd &amp; \"c:/bfolder/somexecutable.exe\" -flag1 -flag2 \"$inputfile\" &gt; outputfile.log", $retary, $retval);
  print_r($reary);
  print $retval;
  </code></pre>
  
  <p>However, if I do not chdir to a network path prior the exec call then everything works fine. It seems that when php cwd is set to a Network path any exec initiated from then on fails.</p>
  
  <p>To sum up, I need c:\afolder\win32\pdftotext.exe to run from PHP using exec and read it's input file from a network-share and write its output but on a Windows Network Location.</p>