# (BAT) Launch JupyterLab on a shared folder of Google Drive for desktop

date: 2021-04-30 | mod: 2021-04-30

# Introduction

Google Colaboratory allows you to run Python like Jupyter Notebook or Jupyter Lab in your browser (Project Jupyter).

Notebooks created in Google Colaboratory are stored in the user’s My Drive as a “Colab Notebook” folder. You can also share this folder with others, in which case a shortcut will be saved in your “My Drive” folder.

Google Drive has a Google Drive for desktop. Mounting it is very convenient because it allows you to work on directories on the drive like a local storage.

So far, we have found the following motivation

• I want to run Jupyter Lab on a folder on my Google Drive.
• I also want to use the shared folder as a working directory.
• I want to start Jupyter Lab on the Anaconda virtual environment.
• I want to automate this process with a bat file.

In this article, we will describe how to execute everything from moving directories to starting JupyterLab using bat.

The working environment is assumed to be Windows 10.

# Method

• Activate the virtual environment (your-env in the following).
• Go to drive G.
• Go to the nodebook shared folder on Google Drive.
• where your-folder-id is an arbitrary id.
• Access the shared folder with Explorer to get the PATH.
• Start Jupyter Lab.
@echo off
call C:/ProgramData/Anaconda3/Scripts/activate.bat
call activate your-env
G:
cd ".shortcut-targets-by-id/your-folder-id/Colab Notebooks"
jupyter lab


At least in the Windows 10 version of Google Drive for PC, you will get the path to the shared notebook folder as G:/.shortcut-targets-by-id/your-folder-id/Colab Notebooks directly under the mount as drive G.

Using this script we can move the directory and start Jupyter Lab as a bat file.

This will activate the virtual environment and launch Jupyter Lab in the browser, and the directory in the home screen will be on the target folder.