I followed the instructions given in this answer: https://vi.stackexchange.com/a/16436/25843, and I've set my shell to point to wsl.exe like this (wsl.exe path seems to be different on my machine compared to the linked answer):

if has("windows")
    set shell=C:\Windows\System32\wsl.exe
    set shellpipe=|
    set shellredir=>
    set shellcmdflag=

But I end up getting this error if I try to run, let's say :!ls:

C:\Windows\System32\wsl.exe  "ls"
'C:\Windows\System32\wsl.exe' is not recognized as an internal or external command,
operable program or batch file.
shell returned 1
Hit any key to close this window...

However, directly running C:\Windows\System32\wsl.exe "ls" in the command line seems to work. Also, setting the shell to point to the PowerShell executable seems to work as well, so I'm confused about what I am missing here.

1 Answer 1


Ok, my bad. Turns out the path should really be C:\Windows\Sysnative\wsl.exe, as mentioned in the linked question. I changed it to System32 because I couldn't find the Sysnative folder under C:\Windows.

Apparently the Sysnative folder is kind of a virtual folder which exists only from the perspective of 32-bit programs.

More info can be found here:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.