Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding "Open Anaconda Prompt here" to context menu (Windows)

I'd like to add an option on my context menu (Windows 7 and 10) to open an Anaconda Prompt into the file location when I right-click the folder, but I can't figure out the right registry key.

Here's what I know how to do:

  • Add an item to the context menu that opens a normal command window at the folder location
  • Open an Anaconda prompt from cmd (run their "activate.bat" file)

What I can't figure out is how to combine these steps into a single registry key so I can open an Anaconda Prompt and then cd in that prompt to the current folder. But maybe I'm approaching this the wrong way.

Help from internet gurus is appreciated.

like image 453
jrinker Avatar asked Oct 10 '17 09:10

jrinker


People also ask

How do you open Anaconda Navigator prompt?

if you had successfully installed the anaconda the in windows 10 search bar you can type anaconda prompt to get the anaconda command line where you can start anaconda navigator by typing anaconda-navigator in anaconda prompt.

How do I change the location of Anaconda prompt?

The Best Answer is Go to Start and search for "Anaconda Prompt" - right click this and choose "Open File Location", which will open a folder of shortcuts. Right click the "Anaconda Prompt" shortcut, choose "Properties" and you can adjust the starting dir in the "Start in" box.


2 Answers

In recent Anaconda versions (I'm at conda 4.5.5) they have changed the behaviour and the shortcut to Anaconda Prompt, so the new procedure is in fact a bit simpler than described by bdforbes.

The new way to launch Anaconda Prompt in a folder is

cmd.exe /K %%USERPROFILE%%\AppData\Local\Continuum\Anaconda3\Scripts\activate.bat

pushd is to change the current directory, %V is the current directory, and /K is to run a command.

So the modified cwp2.py is not needed anymore. Put the following contents in a .bat-file and run as administrator to add the needed keys to the registry (a modified version of the gist posted by Thibaud Ruelle in the comments to the other answer)

REG ADD HKCR\Directory\Background\shell\Anaconda\ /ve /f /d "Anaconda Prompt Here"
REG ADD HKCR\Directory\Background\shell\Anaconda\ /v Icon /f /t REG_EXPAND_SZ /d %%USERPROFILE%%\\Anaconda3\\Menu\\Iconleak-Atrous-Console.ico
REG ADD HKCR\Directory\Background\shell\Anaconda\command /f /ve /t REG_EXPAND_SZ /d "%windir%\System32\cmd.exe pushd "%V" "/K" %%USERPROFILE%%\Anaconda3\Scripts\activate.bat %%USERPROFILE%%\Anaconda3"
REG ADD HKCR\Directory\shell\Anaconda\ /ve /f /d "Anaconda Prompt Here"
REG ADD HKCR\Directory\shell\Anaconda\ /v Icon /f /t REG_EXPAND_SZ /d %%USERPROFILE%%\\Anaconda3\\Menu\\Iconleak-Atrous-Console.ico
REG ADD HKCR\Directory\shell\Anaconda\command /f /ve /t REG_EXPAND_SZ /d "%windir%\System32\cmd.exe pushd "%V" "/K" %%USERPROFILE%%\Anaconda3\Scripts\activate.bat %%USERPROFILE%%\Anaconda3"
like image 96
Filip S. Avatar answered Sep 28 '22 12:09

Filip S.


  1. Run Registry Editor (regedit.exe)
  2. Go to HKEY_CLASSES_ROOT > Directory > Background > shell
  3. Add a key named AnacondaPrompt and set its value to Anaconda Prompt Here
  4. Add a key under this key called command, and set its value to cmd.exe /K C:\Users\user\Anaconda3\Scripts\activate.bat change the location to wherever your Anaconda installation is located.
like image 37
kdebugging Avatar answered Sep 28 '22 12:09

kdebugging