First you need to add Anaconda path to the environment variable.
anaconda base path
and <anaconda base path>/Scripts
to the environment variable.
Then you can execute conda commands through your cmd
next step is writing the batch file.when your batch file is running there are few things to execute
- find the python.exe path
- find the actual python script path
- run the activate.bat file in anaconda
- activate the environment
- execute the python script
batch file look like this
@ECHO on
call <anaconda_dir>\Scripts\activate.bat
call activate <environment name>
"C:\Program Files\python\Python.exe" "<path to your script\script.py"
PAUSE
notes - you can save bat file anywhere if you specified absolute path in "<path to your script\script.py"
.