In Linux, there is what is called a shebang, on the first line of a file, defining which interpreter should be used for a script, it looks like this for /bin/bash
, for example:
#!/bin/bash
myscript
In Windows, you cannot do this directly, you should use an environmental variable called PATHEXT
instead, as described here.
To quote that answer, your variable contains a chain of extensions it recognizes:
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
You must add the extension of your script to the variable (explained here), and then associate it with the interpreter you want to use (in your case, your Python one):
ASSOC .foo=FooScript
FTYPE FooScript=foorunner.exe %1 %*
(Note that these commands permanently change the association, so keep that in mind if the path to your Python interpreter changes for example).