<jupyter_start><jupyter_text>How-to DOS batch file to activate a Python environment, execute Python script, and deactivate environment **Step 1:** Create a DOS batch (.bat) file per this StackOverflow [question](https://stackoverflow.com/questions/69068/long-commands-split-over-multiple-lines-in-windows-vista-batch-bat-file), you use ```space``` + caret symbol to run a command that spans multiple lines. Contents of "test.bat": @echo offd:D:\Miniconda3_32bit\condabin\activate.bat pydata && ^D:\Miniconda3_32bit\envs\pydata\python.exe D:\jupyter\BRG_BRAIN\workshops\Intro_To_Python\etl.py && ^D:\Miniconda3_32bit\condabin\conda.bat deactivate && ^D:\Miniconda3\envs\notebook\Scripts\deactivate.bat && ^exit /B The above does the following:- Change to D: drive (by default, my DOS terminal is first launched in Y: drive, may be different for you)- Activate my virtual environment- Change to the directory that has my Python script- Execute the Python script- Deactivate the virtual environment- exit- Try to Close Command Prompt window **Step 2:** Add a new "Basic Task" in Windows Task Scheduler and reference the .bat file in Windows Scheduler in the ```Actions``` tab by going through the "Create Basic Task..." dialog wizard and then you're done!<jupyter_code>from IPython.display import Image 
Image(filename='task_scheduler.png')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10460863204096561, 'fraction_numerical': 0.012435991221653255, 'mean_word_length': 5.452830188679245, 'pattern_counts': {'":': 1, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '256650', 'license': 'MIT', 'n_tokens_mistral': 419, 'n_tokens_neox': 396, 'n_words': 146, 'path': 'jupyter_notebooks/scheduling_tasks/Windows_Task_Scheduler.ipynb', 'repo_name': 'manual123/Nacho-Jupyter-Notebooks', 'size': '1367'}