A memo about how to execute Windows executable files/processes from WSL Bash.
Normally, in WSL, it’s possible to launch Windows applications. It became possible.
$ explorer.exe .
$ calc.exe
However, for some software like AutoHotkey, errors may occur.
script file not found.
After thinking about a solution, I found that the following command works:
cmd.exe /C "C:\Program Files\AutoHotkey\AutoHotkeyU64.exe" C:/pg/autohotkey/your_script.ahk
If you get the following error, you’re probably writing something like /mnt/ where you should be writing C:.
The system cannot find the path specified.
Also, with this code, the command line won’t progress even after the executed file finishes. This means that when using it in shell scripts, you need to separate the files.
shellScript.sh
. cmd.sh &
cmd.sh
cmd.exe /C "C:\Program Files\AutoHotkey\AutoHotkeyU64.exe" C:/pg/autohotkey/per5_printScreen.ahk
By using &, you execute a separate shell script as a background process.
That’s all.