Access to Windows Files from WSL/Linux
As with Howard Owen's answer, I use a symlink (also called "winhome") to my Windows profile directory. But I'm not sure that answers your real question, since it doesn't sound like the Windows directory you need to access is your profile (based on the "long and error prone" part). That said, you can always create a symlink to whatever Windows directory you need.
Or you can create a bind mount. E.g.
sudo mkdir /mnt/project
sudo mount --bind /mnt/c/really/long/path/to/project /mnt/project
ls /mnt/project
That said, there's one very important consideration when accessing Windows files from Linux -- WSL1 is around 10 times faster than WSL2 in doing so. You don't mention which version you are using, but I'd recommend making sure you at least have a WSL1 instance installed for these types of file operations, especially if the workload involves a large number of small files.
Accessing files on the Linux/WSL filesystem from Windows
You mention PowerShell specifically. To create a shortcut from the Windows drive in PowerShell to a directory in WSL/Ubuntu, do the following from an administrative PowerShell session:
Set-Location location\for\link
New-Item -Path project -ItemType SymbolicLink -Value \\wsl$\Ubuntu
... where project
is the name of the shortcut directory you want, and \\wsl$\Ubuntu
is dependent on your distribution name (obtained by wsl -l
, but "Ubuntu" by default for the first Ubuntu distribution installed).
Of course, you can just as easily use a file manager (e.g. File Explorer, although I prefer Directory Opus) in Windows if you'd like. The \\wsl$\Ubuntu
pseudo-share is available whenever WSL is running (but disappears when the WSL instance is in the "Stopped" state).
Using the symlink creates an interesting case, at least for me. While I would have expected access to fail if WSL isn't running, but it seems that just listing the contents of the location\for\link\project
will result in the WSL instance going form "Stopped" to "Running". So that seems good.
Other options
You may also want to look into "quick cd" options, as mentioned in this blog post. These are available for both PowerShell and certainly most any Linux distribution. The one mentioned by Hanselman apparently works for both.