You will probably need to add swipl to your search path by adding it to the environment variable in the control panel, or looking up how to do it via Powershell. You might also associate your prolog scripts with a particular file extension, so Windows doesn’t confuse prolog files ending in *.pl with Perl scripts.
Couldn’t you also just compile the Prolog program and add it to the PATH directly?
swipl is already in my path, when I run my script on a terminal,
windows edits the script but does not run it.
I am not familiar with Windows, may be I missed something…
Handling #! is a Unix facility. Won’t work on Windows. If you associate “.pl” files with swipl-win.exe you can double click them in the Windows explorer to open and run them. If you need a real executable program you have two options:
Use a saved state (swipl.exe -o myexe -c file.pl ...). Make sure the directory holding libswipl.dll is in %PATH%.