Also a similar vein as @apena's post as it is specific to bash.
In my case I wanted Debian to open on my current working directory.
Although I couldn't exactly get this behavior I was able to get it to open the last directory visited (effectively) using a few hacks:
In my linux distro, I added this to my .bashrc
to intercept all calls to cd
and store the last call to cd
into a destination of my choice.
cd() {
builtin cd "$@" ; echo $PWD > /opt/chdir/lastestdir
}
Next, since Windows Terminal didn't let me inline the command, I created this batch script to in a custom location:
@echo off
for /F "tokens=*" %%n IN (\\wsl$\Debian\opt\chdir\lastestdir) DO @(wsl.exe -d Debian --cd \\wsl$\Debian%%n)
NOTE: \\wsl$\Debian
is the path to my distro within Powershell, and the \opt\chdir\lastestdir
is based on the path I used in the previous step.
Next, I edited the profile for Debian in Windows terminal to point at my script:

I'm open for suggestions, but this let me happily duplicate my current directory to the next tab as long as it was the last terminal I had changed directory in.