title: aws s3 command does not work in a batch file triggered by a Windows task scheduler
body: <p>I have a batch file <code>C:\upload_to_s3.bat</code>. In this file, there is a line:</p>
  <pre><code>aws s3 sync D:\S3\batch1\ s3://MyBucket/batch1 --exclude *.bat
  </code></pre>
  <p>I have Windows task scheduler &quot;S3 Hourly Sync&quot; that runs every hour to trigger to run <code>C:\upload_to_s3.bat</code>. But this command does not do anything - the file upload never happened.</p>
  <p>It runs perfectly if I double click on <code>C:\upload_to_s3.bat</code>.</p>
  <p>This is Windows 2008 Standard server. I have installed AWS CLI and configured with the command &quot;aws configure&quot;, and entered my access key and secret key. That is why it runs if I double click the batch file.</p>
  <p>The Windows Task Scheduler is run as &quot;<code>[MyServer]/Administrator</code>&quot; account.</p>
  <p>So why doesn't the &quot;<code>aws s3 sync</code>&quot; command work when triggered by the task scheduler?</p>
  <p>Do I need to add a line before &quot;<code>aws s3 sync</code>&quot; to set credentials first? If so, how?</p>
  <p>Thank you!</p>