title: Windows task scheduler not running python script/batch file
body: <p>I have a very simple python script (to send an email) which works perfectly when I run it in the cmd window, or in python, or if I directly start a a .bat file pointing to it. </p>
  
  <p>However, when I try to get the task scheduler to run it, nothing happens.  The task scheduler says that it runs and completes successfully, the log file is blank, but no email is sent.</p>
  
  <p>I'm aware there are a lot of other questions relating to this problem, and I've read through them and tried the solutions, but nothing seems to work.  I am new to python (and to scheduling tasks!), so I may be implementing the solutions incorrectly.</p>
  
  <p>Here is what I've tried...</p>
  
  <ul>
  <li><p>Creating a batch file with the script in it in various ways:</p>
  
  <pre><code>python C:\Users\me\Documents\etc\script.py &gt;C:\Users\me\Documents\etc\log.txt
  
  python "C:\Users\me\Documents\etc\script.py &gt;C:\Users\me\Documents\etc\log.txt"
  
  C:\Users\me\AppData\Local\Programs\Python\Python35-32\python.exe C:\Users\me\Documents\etc\script.py
  
  "C:\Users\me\AppData\Local\Programs\Python\Python35-32\python.exe" "C:\Users\me\Documents\etc\script.py"
  
  C:\Users\me\Documents\etc\script.py
  </code></pre></li>
  </ul>
  
  <p>All of these work fine when double clicking on the file - but none run in task manager. (Although they say they have completed successfully). In task manager I just put the link to the .bat file in the "Program/script" box.</p>
  
  <ul>
  <li><p>Doing the above but with the full path to the cmd.exe in the program/script, and the .bat file as an argument.  I've also tried putting the location of the bat file in the "Start in (optional):"</p></li>
  <li><p>Trying to run the .py file directly via the task scheduler, putting it in the "Program/script:" box</p></li>
  <li><p>Trying to run the .py file directly via the task scheduler, putting the full path to the python.exe (see above) in the "Program/script", and the sript.py in the "Add arguments".  I've also tried this with path to the location of the script in "Start in".</p></li>
  <li><p>Trying to run the .py file via the cmd - so putting the full path to the cmd.exe in "Program/script" and the script.py file (full path) in the "Arguments".</p></li>
  </ul>
  
  <p>Some of the ones where I try to run the script.py directly just say "running" in the Task Scheduler forever, but I didn't note down which these were.  </p>
  
  <p>I'm running Windows 7 (64bit), and have got Python 3.5.1 (32bit).  I've got local admin rights.  </p>
  
  <p>Other scheduled tasks I have created (not involving a python script) work fine, but this has stumped me.  Please help!</p>