title: Windows task scheduler not running a batch file that calls a python selenium script
body: <p><strong>Desired Result</strong></p>
  <p>Hi, I am using a machine running windows 10 to automate a scraper that is written in python and uses selenium (with chrome driver). I want this to run every day at 3:00 am.</p>
  <p><strong>Best Attempt</strong></p>
  <p>It seems the best way to do this is to write a batch file <code>test_bat.bat</code> that runs the python script in its virtual environment. Here are the contents of <code>test_bat.bat</code>:</p>
  <pre><code>C:\Users\data_miner\PycharmProjects\SeleniumScraper\venv\Scripts\activate.bat &amp;&amp; python C:\Users\data_miner\PycharmProjects\SeleniumScraper\ScraperWindows.py
  </code></pre>
  <p>I learned how to do this <a href="https://stackoverflow.com/questions/34622514/run-a-python-script-in-virtual-environment-from-windows-task-scheduler">here</a>. This works excellently when run by clicking on the .bat file icon directly.</p>
  <p><strong>Problem</strong></p>
  <p>However, when fired (whether by the trigger or manually) there is no effect other than a change of status from 'ready' to 'running' and the pictured rows in history:</p>
  <p><a href="https://i.stack.imgur.com/5a39t.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5a39t.png" alt="enter image description here" /></a></p>
  <p><strong>Details</strong></p>
  <p>The Action that I created has the following values (instructions were followed from <a href="https://www.thewindowsclub.com/how-to-schedule-batch-file-run-automatically-windows-7" rel="nofollow noreferrer">here</a>):</p>
  <p><em>Action:</em> Start a program, <em>Program/script</em>: C:\data_miner\Desktop\test_batch.bat</p>
  <p>(<em>&quot;C:\data_miner\Desktop\test_batch.bat&quot;</em> is the path to the batch file)</p>
  <p><strong>A similar problem that I have read the solution for:</strong></p>
  <p><a href="https://stackoverflow.com/questions/34200551/python-script-from-batch-file-wont-run-in-task-scheduler">HERE</a>: the solution to this problem was setting the &quot;working directory&quot; to the location of the bat file. I first assumed that by working directory, they meant the 'Start in (optional)' field in 'Actions', this didn't work. Secondly I tried adding a cd command to the first line of the batch file: <code>cd C:\data_miner\Desktop</code> this also made no difference.</p>
  <p><strong>Comments</strong></p>
  <p>I can provide the python scripts if appropriate but chose not to here as the script works fine when run from the bat. The problem is in the transition from opening the bat to getting task scheduler to open it.</p>
  <p>How do I get this thing to work?</p>