title: Executing PHP file via .BAT
body: <p>I am trying to create an installer by executing a PHP file via a Bat file on windows. The PHP file then imports a DB at some stage along with some other installations.</p>
  
  <p>I have been able to do it with other files but no matter what I do on this particular file it always gives me this error:</p>
  
  <p>.BAT FILE</p>
  
  <pre><code>@echo on
  "C:\uwamp\bin\php\php-7.0.3\php.exe" -f "C:\Program Files\Asset\install\importdb.php"
  pause
  </code></pre>
  
  <p>ERROR MESSAGE:</p>
  
  <pre><code>C:\Program Files\Asset\install&gt;"C:\uwamp\bin\php\php-7.0.3\php.exe" -f "C:\Program Files\Asset\install\importdb.php"
  The system cannot find the file specified.
  </code></pre>
  
  <p>PHP FILE:</p>
  
  <pre><code>&lt;?php
  
  $restore_file  = "C:\Program Files\Asset\install\asset.sql";
  $server_name   = "localhost";
  $username      = "root";
  $password      = "root";
  $database_name = "asset";
  
  $cmd = "mysql -h {$server_name} -u {$username} -p{$password} {$database_name} &lt; $restore_file";
  exec($cmd);
  ?&gt;
  </code></pre>
  
  <p>The behavior is strange because I have another 2 BAT files running the same code executing different PHP files from the exact same directory. </p>
  
  <p>DIRECTORY:
  <a href="https://i.stack.imgur.com/l63bw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l63bw.png" alt="directory listing"></a></p>