Python Forum

Full Version: How to run script from batch file?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have Anaconda on a Windows Server. I would like to run a script at ever start up from Task Scheduler. I've only ever been running my code from Spyder directly. How can I call the script to run and not to open up from a Batch file?

Note: Python isn't seen from the CMD line using python

I'm guessing the Bat file would be something like:

%windir%\System32\cmd.exe "/K" C:\ProgramData\Anaconda3\Scripts\activate.bat C:\ProgramData\Anaconda3
"python C:\Users\Administrator\Desktop\HelloWorld.py"
I think I got it. In case it helps anyone else.
 
@echo on call C:\ProgramData\Anaconda3\Scripts\activate.bat
C:\ProgramData\Anaconda3\python.exe "C:\Users\Administrator\Desktop\HelloWorld.py"