1

When I am pasting a Windows path into a WSL console window, it gets translated automatically to a WSL path, e.g. C:\Windows is pasted as /mnt/c/Windows.

However, this does not reflect root setting in /etc/wsl.conf

For example, I edit /etc/wsl.conf and replace line root = /mnt/ with root = / and then run Restart-Service -Name "LxssManager" in Powershell and restart WSL.

Now Windows drives are mounted into root directly as /c/, /d/ etc, but pasting C:\Windows still results in /mnt/c/Windows. How can I change this so that it pastes /c/Windows?

As far as I understand the utility that actually handles the translation is wslpath but I can't find how to configure it.

1 Answer 1

1

When I am pasting a Windows path into a WSL console window, it gets translated automatically to a WSL path

For clarity, there are two default terminals that WSL might use:

  • Under Windows 10, the legacy Windows Console Host
  • Under Windows 11 (if configured), Windows Terminal

Unless I'm missing something, neither of these does the path translation that you mention. Windows Console Host is just too old, with no new features other than UTF-8 support in quite a few years. And Windows Terminal has an outstanding feature request (#1772) for this.

Based on a comment in that issue, I think it's likely that you are using the ConEmu or cmder (based on ConEmu) terminal. Windows-to-POSIX path translation is a feature of those terminals.

If that's the case, to change the path prefix that is used, go to Settings->Tasks and edit the task you use to start WSL. Change (or add) the:

-cur_console:pm:""

The empty string will remove the prefix, so that it will paste as /c/Windows instead of /mnt/c/Windows.

See this issue and the referenced documentation page.

1
  • 1
    Wow, it somehow didn't occur to me that it could be ConEmu. You are right, that's the one I am using. Although I just run ConEmu and type 'wsl'. There isn't a specific task in its settings for WSL. So, given my usecase, if I launch WSL with wsl -new_console:pm:"", I get the desired result. cur didn't have an effect though. Thanks!
    – Asu
    Commented Sep 14, 2022 at 12:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .