WSL starting in /mnt/c/windows/system32

WSL starting in /mnt/c/windows/system32

I installed WSL2 with Ubuntu 20.04 on Windows 10 (21H2 Build 19044.1766) a while back now, but I haven't had a use for it until now.

When I start WSL, I wind up in /mnt/c/windows/system32 rather than a home directory. I've googled why this might happen and can't find anything. As I only use WSL2 and VSCode together for writing code, and I have a code directory in my Dropbox, I would ideally like to have this code directory be a folder below my home directory, but still in my Dropbox. I lost my house in the Colorado Marshall Wildfire in December, but I didn't lose any data as everything is in my Dropbox so that's where I would like to keep it.

Anyway, the first step is why is WSL throwing me into the Windows' system directory? How can I change this?

Then, any ideas on how I can get this to use my Dropbox directories? I am happy to create a user directory and then put the code directory under it, but within the Dropbox so it is backed out to the cloud.

However, if this is going to cause issues, then I would probably script something to back it up to Dropbox I guess.

答案1

why is WSL throwing me into the Windows' system directory?

By default, WSL starts in the current working directory of its parent process. This can vary by starting method. For instance, for me on Windows 11:

  • Typing wsl.exe into the Start menu (via

相关内容