0

I want to run a sequence of commands in anaconda prompt, namely:

activate islp - to activate the library environment set up in Anaconda Navigator
cd C:\Users\user\OneDrive\Desktop\Coding project - to change directory to my coding project
jupyter lab - to open Jupyter lab.

Based on the below article:
https://medium.com/@roddyjaques/how-to-run-anaconda-programs-with-a-bat-file-5f6dd7675508

I created a .bat file:

call "C:\Users\user\anaconda3\condabin\activate.bat"
activate islp
cd "C:\Users\user\OneDrive\Desktop\Coding project"
jupyter lab
pause

and I can see the anaconda prompt opening briefly, however it closes without opening the Jupyter Lab app in the browser.

Also the pause command does not leave the anaconda prompt window open, as it is desribed in the article.

Is the syntax in the file incorrect? If there is a different solution other than a batch file I'm also fine with it, I just want to execute changing the environment, changing the directory and starting up Jupyter lab with one action.

1 Answers1

0

The issue was that the activate islp command line did not have the call command in front of it, and so the batch processing was never returned to the initial batch file. The working script is as follows:

call "C:\Users\user\anaconda3\condabin\activate.bat"
call activate islp
cd "C:\Users\user\OneDrive\Desktop\Coding project"
jupyter lab
Mofi
  • 46,139
  • 17
  • 80
  • 143