title: Batch with No args runs as job (scheduled task) with no errors, Batch with 1 arg fails with Access Denied. Why?
body: <p>Here's a trivial batch: </p>
  
  <pre><code> @echo off
   if not .%1==.-b goto else
   echo Running with -b flag ON 
   goto endif
   :else
   echo Running with NO flags
   :endif
  </code></pre>
  
  <hr>
  
  <p>Now, trying to run this from a scheduled task on a <strong>Windows Server 2003</strong>...</p>
  
  <p>If the task is ran like: "C:\Test\test.bat" then the log (Schedlgu.txt) says: </p>
  
  <p>"Test Job.job" (test.bat)
      Started 7/14/2010 10:27:19 AM
  "Test Job.job" (<strong>test.bat</strong>)
      Finished 7/14/2010 10:27:19 AM
      Result: The task completed with an exit code of (0).</p>
  
  <p>However, when running like: "C:\Test\test.bat -b" then:</p>
  
  <p>"Test Job.job" (<strong>test.bat -b</strong>) 7/14/2010 10:28:02 AM ** ERROR **
      Unable to start task.
      The specific error is:
      0x80070005: <strong>Access is denied</strong>.
      Try using the Task page Browse button to locate the application.</p>
  
  <hr>
  
  <p>The task is running under the Admin account (of the domain). I have also granted full access  to this user to the local cmd.exe</p>
  
  <p>Any thoughts why the task fails when running a batch with one argument?</p>
  
  <p>Thx</p>