I found the extension jupyterlab_open_in_terminal_extension that allows you to open a terminal in the directory of a file you right-click from the file browser.
Unfortunately I have a lot of problems running it on Windows.
For instance, it doesn’t work from the user directory. Looks like ~ is not expanded into a full path.
Also, it doesn’t work if the path contains square brackets ([). Looks like in Windows you need to escape those.
I went in the source code after the path is retrieved from the file browser but before the terminal is opened and added this code to try to convert relative path into absolute one and resolve the ~, but nothing:
// Change relative path into absolute path
let targetPathOld: string = targetPath;
let serverRoot: string = PageConfig.getOption('serverRoot');
targetPath = PathExt.resolve(serverRoot, targetPath);
console.log(`Resolved into absolute path: ${targetPathOld} -> ${targetPath}`);
targetPathOld = targetPath;
// These are grave accents (U+0060), not backticks `
//targetPath = targetPath.replace("[", "`[");
//targetPath = targetPath.replace("]", "`]");
//console.log(`Escaped square brackets: ${targetPathOld} -> ${targetPath}`);