Productivity Tip: Adding Jupyter and Anaconda shortcuts to Windows’ right-click context menu | by Gabriel Signoretti | Towards Data Science

This is going to be a quick one and, if you are anything like me and is used to mostly work with Linux computers for development, you may find this useful. As I just said, for most of my life I’ve primarily used Ubuntu systems to do almost all of my programming work. But recently I've gotten a little fed up with some compatibility issues and decided to give good old Windows a try.
So, there I went setting up the fresh Windows installation, configuring the necessary programming environments, downloading and installing the Anaconda package and whatnot. Then I noticed the lack of a simple but extremely handy tool that I used quite a lot on Ubuntu: the “Open in Terminal” option on the right-click context menu.
This might seem like not a big deal at all (and honestly, it might not even be haha), but it saved me a lot of time when I was working on multiple Jupyter notebooks in different folders. With it I could just navigate to the desired folder, open a new terminal window directly from there, run Jupyter, and just start working, instead of having to navigate to each and every folder from the terminal itself.
So, I don’t know how much of a ‘missing feature’ this is for most people, but it certainly is for me! And if you’ve read this far, chances are that it is for you too, so lets cut to the chase, shall we?
After searching for the possibility online, I discovered that it’s not so cut and dry to do, but is not that complicated either, so bear with me!
The first thing to do is discover the PATH to your Anaconda installation. If you used the default location during the installation process it should be located somewhere like this:
C:\Users\<your_user>\anaconda3
We need to know this location because we are going to be using the activate.bat batch script from the Scripts folder in order to open the Anaconda Prompt.
The next thing you need to do is run the Registry Editor. To do so, just type regedit.exe in the Windows search and it should pop up even before you finished typing it.
You should pay close attention for the next steps, as you DO NOT want to to mess with the wrong things here. So be advised!
With that out of the way, lets get back to it. As you can see, there are a bunch of folders to the left, and you will have to navigate to the following one:
HKEY_CLASSES_ROOT > Directory > Background > shell
You can either find it by navigating the folder tree to the left or by typing the corresponding path in the address bar on top. Once you open it, you should see something like this on the left panel:
This is where you can add custom commands to the context menu. As you can see, since I have both VSCode and PyCham installed, they each have a command listed here, as both of them have a “Open with ... “ option listed in the right-click context menu.
So, in the shell folder you should create 3 new keys, one for each new command that we would like to add: AnacondaPrompt, JupyterLab, and JupyterNotebook. Right click on the shell folder and select New > Key. These keys should be on the same level as the cdm, PowerShell, and whichever other more appear on your system, otherwise it won’t work.
When you select one of the new keys you should see something like this on the right panel:
Double click on the default attribute and fill the value data field with the text that you want to appear on the context menu for that key: “Open folder in AnacondaPrompt”, “Open with JupyterLab”, and “Open with Jupyter Notebook” for example.
After that, you should add a new key named command under each of the new keys that we have created (weird, I know). Then you should now have something like this:
Finally, the last thing you have to do for it to work is to add the actual commands themselves, obviously. To do that you are going to repeat the processes that you did to add the text to the other keys: edit the default attribute on the command key and fill the value data field, but instead of plain text, you will write the actual command. For each of the corresponding keys they are:
AnacondaPrompt > command:
cmd.exe /K C:\Users\<your_user>\anaconda3\Scripts\activate.bat
JupyterLab > command:
cmd.exe /K C:\Users\<your_user>\anaconda3\Scripts\activate.bat && jupyter-lab
JupyterNotebook > command:
cmd.exe /K C:\Users\<your_user>\anaconda3\Scripts\activate.bat && jupyter-notebook
Don’t forget to add your actual user name, or even change the entire anaconda path in case yours was installed somewhere else in your system. The important thing is to provide the correct address to the activavate.bat script, as it is the default script used to actually open the anaconda prompt.
If you are curious to understand how these commands work, here is what each section of them does:
cmd.exe — Opens the CMD on the respective folder (the one that you are right-clicking in);
/K — Tells the CMD to issue the command that follows, and then stay open so that you can view results or type more commands;
C:\...\activate.bat — Runs the activate.bat scripts, opening the AnacondaPrompt environment;
&& — An “And” logical operator. It runs the next command on the line after the first one has returned successfully;
jupyter-lab or jupyter-notebook — command used to open either the jupyter lab or the jupyter notebook, whichever you prefer;
So, after all that, you should have 3 brand new and working options on your right-click context menu! Go check it out in some folder, it will be looking something like this:
Well, that’s great, it works like a charm! but the menu sure looks a little empty, doesn’t it? some might even say incomplete...
Yes! and its actually pretty simple to do so. Go back to the new keys that you added (the top level ones, not the command ones), right click on it and select New > String. This should create a new row of attributes on the right panel. Name the attribute as Icon and provide a path to an icon file (.ico extension) as the value data.
I`ve used some of the default icons that ship with the Anaconda package (how convenient) in my keys, here is where to locate them:
AnacondaPrompt > Icon:
C:\Users\<your_user>\anaconda3\Menu\anaconda-navigator.ico
JupyterLab and JupyterNotebook > Icon:
C:\Users\<your_user>\anaconda3\Menu\jupyter.ico
Then, your final (much cooler) context menu will look like the one shown below, but feel free to use other icons if you prefer.
With that we conclude this brief tutorial, I hope that you liked it and maybe even learned something new! Thanks for the read!
You can export these newly created keys for backup or if you want to add them to other installations of Windows. All you have to do is right click on the desired key and select export;
You can also add other commands using the same process to suit your specific needs, but be careful not to mess with other options that you are not familiar with. After all, with great power comes great responsibility;