title: Change current working directory from batch file and run script
body: <p><strong>In Windows 8:</strong> I have a php file which needs to be run from the scheduled tasks through .bat file.
  The PHP is located in: <strong>P:\php\php.exe</strong>
  The file to run is located in: <strong>W:\folder\file.php</strong></p>
  
  <p>my .bat file looks like this:</p>
  
  <pre><code>cmd /c p:\php\php.exe w:\folder\file.php
  </code></pre>
  
  <p>It does not run. When I open cmd and switch to the file folder and run it from there, the file executes properly. </p>
  
  <p>i.e.: <code>W:\folder&gt; p:\php\php.exe w:\folder\file.php</code></p>
  
  <p>I have to add something to the .bat file which navigates to this w:\folder and executes it in the same manner but I cannot figure out what. I tried other posts (replies) i.e.:
  <a href="https://stackoverflow.com/questions/5138507/how-to-change-current-working-directory-using-a-batch-file">How to change current working directory using a batch file</a></p>
  
  <p>but it did not take any effect. Can anyone help me to write the correct command for the .bat file please ?</p>