Not sure whether this is the answer or not (it may be), but the explanation and troubleshooting are a bit long for a comment.
It sounds like you may be on the right track with 32-bit vs 64-bit, but possibly a bit confused on which apps are which architecture.
On 64-bit Windows 10, wsl.exe
is always 64-bit. You can see this (assuming you have put it back in the right place) via:
> file /mnt/c/Windows/System32/wsl.exe
/mnt/c/Windows/System32/wsl.exe: PE32+ executable (console) x86-64, for MS Windows
Moving it doesn't change the architecture, of course.
since the cmd is 64 bit
It's really the architecture of Java and Jenkins that you need to worry about. Is your Java 32-bit or 64-bit?
> 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
I don't run much Java at the moment, but I happened to have a release installed from a while back on one of my systems. Turns out it is 32-bit.
If your java.exe
is 32-bit, then this would most likely explain why you can't run wsl.exe
, which is 64-bit.
-From another research, could be running under 32 bit, since the cmd is 64 bit, so I tried calling from the Sysnative "C:\Windows\Sysnative\wsl.exe", but I get file not found;
I assume that you are referring to this answer or something similar. It sounds like you may have tried that from CMD. Let's do that here for reference:
>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
>
This is correct, since both CMD and WSL are 64-bit. The purpose of Sysnative is to allow you to call a 64-bit from a 32-bit app.
However, if you try that from a 32-bit application, it should work. Try from "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
>
If you try that path from within Jenkins (assuming it is 32-bit), what do you get?
If C:\Windows\Sysnative\wsl.exe
doesn't work for you from Jenkins, and assuming your Java is 32-bit, do you have the option to run 64-bit Java for this task?