You can use wslpath2
to convert a WSL Path to a Windows Path and vice versa.
Internally it calls the wslpath.exe
utility which is a Linux-based utility created by Microsoft to convert Windows and Linux paths.
This is a fork of wslpath by pratikpc with the following changes:
The main function is convert
which has the following signature:
rust
pub fn convert(
path: &str,
distro: Option<&str>,
options: Conversion,
force_absolute_path: bool,
) -> Result<String, Box<dyn std::error::Error>> {
rust
let path = convert("C:\\Users", None, Conversion::WindowsToWsl, false);
Also see the examples folder.