title: Close MS Access from a batch file
body: <p>I am trying to close an MS Acess database from a DOS batch file. I found on StackOverflow a command that looks similar to :-</p>
  
  <pre><code>FOR /F "usebackq tokens=2" %i IN (`tasklist ^| findstr /r /b "MSACCESS.EXE"`) DO taskkill /pid %i
  </code></pre>
  
  <p>When I run this at the command line it works fine. When I place the exact same line in a batch file I get the error :-</p>
  
  <pre><code>i was unexpected at this time.
  </code></pre>