I have a script that i run every day and want to make a schedule for it, i have already tried a batch file with:
start C:\\Users\\name\\Miniconda3\\python.exe
I had a similar problem a few days ago. What I discovered is that anaconda prompt is nothing but your usual cmd prompt after running an 'activate.bat' script which is located in the anaconda 'Scripts' folder. So to run your python scripts in anaconda all you need to do is write 2 lines in a batch file. (Open notepad and write the lines mentioned below. Save the file with .bat extension)
Then you schedule this batch file to run as you wish and it will run without problems.
I'd recommend creating an Anaconda environment with the packages you need, then using the python from that environment to run your script. Read about Anaconda environments here
For example...
Say you create an environment called cristians_env
conda create --name cristians_env
and you install the packages you need
conda install pandas
Then, all you need to do is this from your batch script (assuming you use Anaconda 2)
start C:\Users\name\Anaconda2\envs\cristians_env\bin\python C:\script.py
and voila! You're using your anaconda environment from your batch script!
I would be a bit careful in calling python directly through environment as one never knows if the internals for activate function has changed.
I'm just using basic bat-script to help me out.
SET log_file=%cd%\logfile.txt
call C:\Anaconda3\Scripts\activate.bat
cd \script_directory
python script.py arg1 arg2 > %log_file%
This script saves the log-file wherever the bat is run from, calls the right environment through activate (in this case the standard) and directs all the stdout into log-file for further investigation.
Then just point your Windows Task Scheduler to the script and set the home directory where you want the log-file to appear.
Found a solution, i copied the "activate.bat" file in "C:\Users\yo\Miniconda3\Scripts" and renamed it as schedule.bat and added my script (copy pasted it) on the end of the file.
Then i can schedule a task on windows that executes schedule.bat everyday