Created
May 1, 2022 21:41
-
-
Save jahands/fa51670acccce178059f4029742cfbae to your computer and use it in GitHub Desktop.
A PowerShell function to convert a path to WSL format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function ConvertTo-WslPath { | |
Param( | |
[Parameter(Mandatory = $true, ValueFromPipeline)] | |
[string]$Path | |
) | |
$p = Get-Item $Path | |
$wslPath = "/mnt/$($p.PSDrive.Name.ToLower())$($p.FullName.Substring($p.FullName.IndexOf(':')+1).Replace('\','/'))" | |
$wslPath | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment