Home > OS >  Batch file not running but works when I manually type in to command line
Batch file not running but works when I manually type in to command line

Time:02-20

Hey so I have a pretty simple request for a bat file

%windir%\System32\cmd.exe "/K" C:\Users\kevin\anaconda3\Scripts\activate.bat C:\Users\kevin\anaconda3
conda activate flight
python C:\Users\kevin\Documents\PythonScripts\FDIBASE.py

That is all I want to do. When I go into my command line manually then individually type those three lines it works perfectly fine (it does take a few seconds for each line to finish before I execute the next however)

I am new to bat files so I think its just something wrong with the format but I don't get why it does not work.

CodePudding user response:

See this ref, we need using call to activate the conda environment

call C:\Users\kevin\anaconda3\Scripts\activate.bat C:\Users\kevin\anaconda3\envs\flight

python C:\Users\kevin\Documents\PythonScripts\FDIBASE.py

call conda deactivate
  • Related