Repairing WSL Interoperability
If you suddenly can’t run Windows executables from WSL — things like explorer.exe ., code ., or clip.exe — and you see errors like:
-bash: /mnt/c/Windows/System32/cmd.exe: cannot execute binary file: Exec format error
The culprit is often a missing binfmt.d registration file that tells the kernel how to handle Windows PE binaries.
The fix
Create the file /usr/lib/binfmt.d/WSLInterop.conf with the following content:
:WSLInterop:M::MZ::/init:PF
sudo mkdir -p /usr/lib/binfmt.d
echo ':WSLInterop:M::MZ::/init:PF' | sudo tee /usr/lib/binfmt.d/WSLInterop.conf
Then restart the systemd-binfmt service to apply it:
sudo systemctl restart systemd-binfmt
What this does
The binfmt_misc entry tells the Linux kernel that any file starting with the magic bytes MZ (the DOS/PE header signature used by all Windows .exe and .dll files) should be executed via /init — the WSL interop binary — with the P (preserve argv[0]) and F (fix binary) flags.
Without this file, the kernel has no idea what to do with .exe files and refuses to run them.
Why it goes missing
This file is normally shipped as part of the WSL Linux kernel packages. It can disappear after:
- A distro upgrade that overwrites or removes WSL-specific packages
- Manually cleaning up
/usr/lib/binfmt.d/ - Installing a minimal or container-oriented distro image that never included it
Verify
After restarting systemd-binfmt, check that the entry is active:
cat /proc/sys/fs/binfmt_misc/WSLInterop
The output should start with enabled. Then test it:
explorer.exe .
Your current directory should open in Windows Explorer.