How to convert wslpath /home/user/ to windows path


User 504909

I'm using the Linux Subsystem for Windows 10 (Windows 10 version 1803)

I can use the command line:

user@laptop:~$ wslpath -w /c/
C:\

but when I try to use

user@laptop:~$ wslpath -w ~
wslpath: /home/user: Result not representable

Even if I use:

user@laptop:~$ wslpath -w /home/user
wslpath: /home/user: Result not representable

Why? How to convert /home/user to windows path?

My home folder path in windows isC:\Users\winuser\AppData\Local\lxss\home

I was hoping some command line would allow me to return that string.

Rich Turner

Update guide for Windows 10 1809 or later users:

In Windows 10 1809, we (finally) provide filesystem integration that allows you to access files in WSL distributions from Windows via \\wsl$UNC paths :

enter image description here

If you're interested in how it works, visit this blog post : https://devblogs.microsoft.com/commandline/a-deep-dive-into-how-wsl-allows-windows-to-access-linux-files /

This now allows wslpathWindows-accessible paths to be provided to files in your distribution's filesystem:

enter image description here

In the upcoming Windows 10 May 2020 Update (2004), you won't need to remember the somewhat obscure \\wsl$\UNC paths - just click the Tux (Linux penguin) icon in File Explorer:

enter image description here

Warning for WSL1 users:

Don't try to explore the folder %localappdata%\lxss\...containing the WSL1 Linux files from Windows - there are dragons!

Please read this article : https://blogs.msdn.microsoft.com/commandline/2016/11/17/do-not-change-linux-files-using-windows-apps-and-tools/

The guide doesn't and won't change, but it will become less important over time: in particular, WSL2 doesn't use %localappdata%\lxss- instead store your linux files in VHDX files in EXT4 format, for the distro's The local file system provides near-native IO performance.

Related


Batch script: convert path to linux format using wslpath

Gregor Isack I am trying to convert the current working directory of a .bat script to linux format using wsl wslpath. To show you it works on CMD: However, when I put it in a .bat file and change %cd%to %~dp0, the path is empty: test.batInclude: FOR /F %%i IN

Batch script: convert path to linux format using wslpath

Gregor Isack I am trying to convert the current working directory of a .bat script to linux format using wsl wslpath. To show you it works on CMD: However, when I put it in a .bat file and change %cd%to %~dp0, the path is empty: test.batInclude: FOR /F %%i IN

Batch script: convert path to linux format using wslpath

Gregor Isack I am trying to convert the current working directory of a .bat script to linux format using wsl wslpath. To show you it works on CMD: However, when I put it in a .bat file and change %cd%to %~dp0, the path is empty: test.batInclude: FOR /F %%i IN

Batch script: convert path to linux format using wslpath

Gregor Isack I am trying to convert the current working directory of a .bat script to linux format using wsl wslpath. To show you it works on CMD: However, when I put it in a .bat file and change %cd%to %~dp0, the path is empty: test.batInclude: FOR /F %%i IN

Batch script: convert path to linux format using wslpath

Gregor Isack I am trying to convert the current working directory of a .bat script to linux format using wsl wslpath. To show you it works on CMD: However, when I put it in a .bat file and change %cd%to %~dp0, the path is empty: test.batInclude: FOR /F %%i IN

Batch script: convert path to linux format using wslpath

Gregor Isack I am trying to convert the current working directory of a .bat script to linux format using wsl wslpath. To show you it works on CMD: However, when I put it in a .bat file and change %cd%to %~dp0, the path is empty: test.batInclude: FOR /F %%i IN

How to pass path from shell read command to wslpath

Edwin Bradford I'm trying to write a script that, wslpathwhen run in WSL on Windows, will pass the tool the location of a directory dropped into a bash window . # Drag and drop the directory into the Bash window IFS="" read -r input echo; # If system is Windo

How to pass path from shell read command to wslpath

Edwin Bradford I'm trying to write a script that, wslpathwhen run in WSL on Windows, will pass the tool the location of a directory dropped into a bash window . # Drag and drop the directory into the Bash window IFS="" read -r input echo; # If system is Windo

How to pass path from shell read command to wslpath

Edwin Bradford I'm trying to write a script that, wslpathwhen run in WSL on Windows, will pass the tool the location of a directory dropped into a bash window . # Drag and drop the directory into the Bash window IFS="" read -r input echo; # If system is Windo

How to pass path from shell read command to wslpath

Edwin Bradford I'm trying to write a script that, wslpathwhen run in WSL on Windows, will pass the tool the location of a directory dropped into a bash window . # Drag and drop the directory into the Bash window IFS="" read -r input echo; # If system is Windo

How to pass path from shell read command to wslpath

Edwin Bradford I'm trying to write a script that, wslpathwhen run in WSL on Windows, will pass the tool the location of a directory dropped into a bash window . # Drag and drop the directory into the Bash window IFS="" read -r input echo; # If system is Windo

How to pass path from shell read command to wslpath

Edwin Bradford I'm trying to write a script that, wslpathwhen run in WSL on Windows, will pass the tool the location of a directory dropped into a bash window . # Drag and drop the directory into the Bash window IFS="" read -r input echo; # If system is Windo

How to convert windows path to posix path using node path

dishonest I'm developing on Windows, but need to know how to convert Windows paths (with backslashes ) to POSIX paths \with forward slashes ( /) ? My goal is to convert C:\repos\vue-t\tests\views\index\home.vuetoC:/repos/vue-t/tests/views/index/home.vue so I c

How to convert windows path to posix path using node path

dishonest I'm developing on Windows, but need to know how to convert Windows paths (with backslashes ) to POSIX paths \with forward slashes ( /) ? My goal is to convert C:\repos\vue-t\tests\views\index\home.vuetoC:/repos/vue-t/tests/views/index/home.vue so I c

Convert Windows path to Linux

Ernil Uzbek: I created a CSV file ( driving_log.csvwith a file path for each image created by my emulator), but I was using my brother's Windows computer when I did this, so now the file path looks like this for each image (And almost 14,000 people). When I ca

Convert Windows path to Linux

Ernil Uzbek: I created a CSV file ( driving_log.csvwith a file path for each image created by my emulator), but I was using my brother's Windows computer when I did this, so now the file path looks like this for each image (And almost 14,000 people). When I ca

Convert Windows path to Linux

Ernil Uzbek: I created a CSV file ( driving_log.csvwith a file path for each image created by my emulator), but I was using my brother's Windows computer when I did this, so now the file path looks like this for each image (And almost 14,000 people). When I ca

Convert Windows path to Linux

Ernil Uzbek: I created a CSV file ( driving_log.csvwith a file path for each image created by my emulator), but I was using my brother's Windows computer when I did this, so now the file path looks like this for each image (And almost 14,000 people). When I ca

Convert Windows path to Linux

Ernil Uzbek: I created a CSV file ( driving_log.csvwith a file path for each image created by my emulator), but I was using my brother's Windows computer when I did this, so now the file path looks like this for each image (And almost 14,000 people). When I ca

Convert Windows path to Linux

Ernil Uzbek: I created a CSV file ( driving_log.csvwith a file path for each image created by my emulator), but I was using my brother's Windows computer when I did this, so now the file path looks like this for each image (And almost 14,000 people). When I ca

CMake convert Unix to Windows path

read I'm trying to convert a unix-style MSYS path to a /c/my/path/to/a/folderWindows path, or something CMake would understand to a Windows path C:/my/path/to/a/folder. I want it to work on the already correct path. Is there any proper way? Note: Please do not

CMake convert Unix to Windows path

read I'm trying to convert a Unix-style MSYS path (for example) /c/my/path/to/a/folderto a Windows path, or something CMake would understand to a Windows path C:/my/path/to/a/folder. I want it to work on the already correct path. Is there any proper way? Note: