How to change the working directory in Jupyter in windows 10
1 min readMar 8, 2021
I got a new laptop recently and this time I wanted my home directory for Jupyter notebook to be D drive, instead of C Drive. This is how I came up with this story
- Open Anaconda Prompt and run
jupyter notebook --generate-config
. - This writes a file to
C:\Users\username\.jupyter\jupyter_notebook_config.py
. - Copy the link displayed in Anaconda prompt and browse to the file location and open it in an Editor
- Search for #c.NotebookApp.notebook_dir = ‘’ in the file. And update the required directory where you need your Jupyter to open in quotes.
- Use front slashes for the path. If you want to use back slashes, use double quotes. Remove the # at the beginning of the line to allow the line to execute. Save the file
- This will just update the home directory.
- Then, go to the shortcut of Jupyter Notebook located in
C:\Users\User_name\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Anaconda3 (64-bit)
- Do the right click and go to the
Properties.
In theTarget
field, remove%USERPROFILE%
- Then, In the field of
Start in
, type the same directory updated injupyter_notebook_config.py
- Done. You will be able to see the home directory as your desired directory.