不确定这是否是答案(可能是),但是解释和故障排除对于评论来说有点长。
听起来像你may32 位与 64 位处于正确的轨道上,但可能对哪些应用程序属于哪种架构有点困惑。
在 64 位 Windows 10 上,wsl.exe
始终是 64 位。您可以通过以下方式看到这一点(假设您已将其放回正确的位置):
> file /mnt/c/Windows/System32/wsl.exe
/mnt/c/Windows/System32/wsl.exe: PE32+ executable (console) x86-64, for MS Windows
当然,移动它不会改变架构。
因为cmd是64位的
您真正需要担心的是 Java 和 Jenkins 的架构。你的Java是32位还是64位?
> file "$(command -v java.exe)"
/mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath/java.exe: PE32 executable (console) Intel 80386, for MS Windows
我目前运行的 Java 不多,但我碰巧在我的一个系统上安装了不久前的一个版本。结果发现是32位的。
If your java.exe
是 32 位,那么这很可能解释为什么你不能运行wsl.exe
,这是 64 位的。
-根据另一项研究,可能在32位下运行,因为cmd是64位,所以我尝试从Sysnative“C:\Windows\Sysnative\wsl.exe”调用,但我找不到文件;
我假设你指的是这个答案 https://superuser.com/a/1528297/1210833或类似的东西。它sounds就像您可能已经从 CMD 尝试过一样。我们在这里做一下以供参考:
>C:\Windows\Sysnative\wsl.exe
The system cannot find the path specified.
> wsl.exe
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
>
这是正确的,因为 CMD 和 WSL 都是 64 位。 Sysnative 的目的是允许您从 32 位应用程序调用 64 位应用程序。
但是,如果您在 32 位应用程序中尝试这样做,它应该可以工作。从“Windows PowerShell (x86)”尝试:
> wsl.exe
wsl.exe : The term 'wsl.exe' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ wsl.exe
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (wsl.exe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
> C:\Windows\Sysnative\wsl.exe
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
>
如果您从 Jenkins 内部尝试该路径(假设它是 32 位),您会得到什么?
If C:\Windows\Sysnative\wsl.exe
Jenkins 不适用于您,假设您的 Java 是 32 位,您是否可以选择运行 64 位 Java 来完成此任务?