Created
April 6, 2019 13:25
-
-
Save lski/2dad407989860fa32e93632bf50309fd to your computer and use it in GitHub Desktop.
wslpath wrapper for using directly in powershell
This file contains 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
<# | |
.SYNOPSIS | |
Converts windows path into a linux path and vice versa. | |
.DESCRIPTION | |
Converts windows path into a linux path and vice versa. Use WSL under the hood, so needs to be installed. | |
See docs wslpath docs for more information. | |
.PARAMETER path | |
The path to convert | |
.PARAMETER conversion | |
The direction of conversion windows->linux by default ('-u'). See docs wslpath docs for other options | |
.EXAMPLE | |
wslpath $Profile | |
wslpath $Profile '-w' | |
#> | |
function wslpath( | |
[Parameter(Mandatory)] | |
[string] | |
$path, | |
[ValidateSet('-u', '-w', '-m')] | |
$conversion = '-u' | |
) { | |
wsl 'wslpath' $conversion $path.Replace('\', '\\'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment