Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to remove Windows paths from WSL path

after Build 17093

  • can override settings by edit "/etc/wsl.conf"
  • normally this file is not exists at first
$ sudo vi /etc/wsl.conf

[interop]
appendWindowsPath = false

$ exit
c:\Users\user> wsl

$ echo $PATH

to take effect you should exit and relaunch shell

see also

default wsl.conf settings

[automount]
enabled = true
mountFsTab = true
root = "/mnt/"
options =

[network]
generateHosts = true
generateResolvConf = true

[interop]
enabled = true
appendWindowsPath = true
@useraccessdenied

This comment has been minimized.

Copy link

@useraccessdenied useraccessdenied commented May 29, 2020

Exiting and relaunching doesn't update changes in wsl.conf. Terminating WSL from PowerShell using wslconfig /t Ubuntu command works. I am on WSL2 currently.

@takizo

This comment has been minimized.

Copy link

@takizo takizo commented Aug 11, 2020

Exiting and relaunching doesn't update changes in wsl.conf. Terminating WSL from PowerShell using wslconfig /t Ubuntu command works. I am on WSL2 currently.

Alternatively can use wsl --shutdown in cmd

@ShivKJ

This comment has been minimized.

Copy link

@ShivKJ ShivKJ commented Jul 10, 2021

Thanks @takizo. That worked for me,

@moracabanas

This comment has been minimized.

Copy link

@moracabanas moracabanas commented Sep 24, 2021

I need to WSL2 interop to run code . but the excess of /mnt/c directories from windows in Ubuntu WSL2 PATH leads to slow python runs.
So how could I manually edit appendWindowsPath so I can run code . and just that?

@stevenli6186

This comment has been minimized.

Copy link

@stevenli6186 stevenli6186 commented Oct 10, 2021

This doesn't work at all for me... can you guys provide specific beginner instructions?

@useraccessdenied

This comment has been minimized.

Copy link

@useraccessdenied useraccessdenied commented Oct 11, 2021

This doesn't work at all for me... can you guys provide specific beginner instructions?

ELI5 instructions: open /etc/wsl.conf in text editor which is present in wsl distro. If the file is not present in etc directory, create it. And only put this there.

[interop]
appendWindowsPath = false

Else modify the above line if it exists. Then do wslconfig /t Ubuntu or wsl --shutdown or simply reboot the pc.

@stevenli6186

This comment has been minimized.

Copy link

@stevenli6186 stevenli6186 commented Oct 11, 2021

that also did not work for me...

What I had to do as edit my .bashrc file and add export PS1="\u@\h: "

@useraccessdenied

This comment has been minimized.

Copy link

@useraccessdenied useraccessdenied commented Oct 11, 2021

How did modifying PS1 worked for you? It does entirely different thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment