How does my Windows computer that is running WSL2 know which OS kernel (Windows or Linux) to execute a program with? I know that WSL2 is essentially a lightweight VM but idk how to leverage this knowledge. I thought it might depend on whether or not the program was inside the WSL2 directory but when I moved a Windows executable (explorer.exe) into my WSL2's /home/username directory and executed it, it ran fine and opened File Explorer normally. Is it something about the executable file that lets the computer know which OS kernel (Windows or Linux) to run it with?
I am asking this because I'm wondering if it's ok to keep and work with Linux executables in my Windows directory ("/mnt/c/Users/myname/node projects").