在 /home 下不能 运行 .exe 但在 /mnt/c 下可以

Cannot run .exe when under /home but can when under /mnt/c

在 Windows Linux 的子系统中,当我在 /mnt/c/... 文件结构下时,我似乎能够 运行 一个 .exe 文件,但不是当我在 /home/... 文件结构下时。当我的密码低于 /home/... 时,有没有办法访问 .exe 文件?

$ pwd
/mnt/c
$ "/c/Program Files/R/R-4.0.2/bin/Rscript.exe" -e "print('hello')"
[1] "hello"
$ cd ~
# pwd
/home/mpettis
$ "/c/Program Files/R/R-4.0.2/bin/Rscript.exe" -e "print('hello')"
(nothing run or returned)

如果这是挂载文件系统的任何线索,这是我的 df 输出:

$ df
Filesystem     1K-blocks      Used Available Use% Mounted on
rootfs         498799612 133929648 364869964  27% /
none           498799612 133929648 364869964  27% /dev
none           498799612 133929648 364869964  27% /run
none           498799612 133929648 364869964  27% /run/lock
none           498799612 133929648 364869964  27% /run/shm
none           498799612 133929648 364869964  27% /run/user
cgroup         498799612 133929648 364869964  27% /sys/fs/cgroup
C:             498799612 133929648 364869964  27% /c

创建 /etc/wsl.conf 并在其中定义以下内容:

[automount]
enabled = true
options = "metadata,uid=1000,gid=1000,umask=0022,fmask=11,case=off"
mountFsTab = false
crossDistro = true

[network]
generateHosts = true
generateResolvConf = true

[filesystem]
umask = 0022

[interop]
enabled = true
appendWindowsPath = true

互操作部分明确启用它可能会解决问题。请务必记住,如果您 运行 WSL2 并且还使用 systemd hack,您的 Windows 互操作将中断并且无法执行任何 exe 文件。