Skip to content

Instantly share code, notes, and snippets.

@thesamovar
Created October 18, 2020 11:38
Show Gist options
  • Save thesamovar/bd91f2133f900a3a4871e8ac90ba4657 to your computer and use it in GitHub Desktop.
Save thesamovar/bd91f2133f900a3a4871e8ac90ba4657 to your computer and use it in GitHub Desktop.
Instructions on how to add a Jupyter notebook context menu on Windows

I don't know about you, but I find myself launching juptyer notebooks often enough now that typing the command is annoying. Here's how to add a context menu on Windows to open one in the current directory or the directory you're right clicking on.

First, make a .bat file like this, mine is C:\Users\dgoodman\Scripts\jupyter-here.bat:

	if NOT [%1]==[] (
		cd "%1"
	)
	call conda activate jupyter
	call jupyter notebook

If this isn't your Jupyter notebook environment then obviously modify this appropriately. It's important to use "call" though because the conda command is a .bat file and when one .bat file calls another, you need to use call or it won't return.

Now open registry editor, and find HKEY_CURRENT_USER\Software\Classes\directory\Background\shell. Note that you might need to create the "shell" key if it doesn't exist already. Now create a new key inside this one called "Jupyter notebook here". Create a new key inside that called "command". Now modify the default property inside that command to read C:\Users\dgoodman\Scripts\jupyter-here.bat "%V".

Do the same process in HKEY_CURRENT_USER\Software\Classes\directory\shell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment