Quantcast
Channel: Active questions tagged windows - Super User
Viewing all articles
Browse latest Browse all 9738

Is there a chmod +x equivalent in Windows 10, 11 to allow running scripts in Powershell/cmd with a specified shebang?

$
0
0

I would like to write cross platform scripts in some interpreted language (Python, Go, Node, whatever).

This is trivial in *nix systems (MacOS, Linux, BSD) as I just need to mark a file as executable using chmod +x ./myfile and the system will execute that script using the specified interpreter in the shebang (#!/usr/bin/env python). I can then run the file as though it were an executable using ./myfile.

I would like to replicate this in Windows, however in Powershell running .\myfile attempts to open that file using the graphical OS "choose what application to run this with" dialog.

Is there an equivalent to chmod +x ./myfile && ./myfile in Windows or do I have to instruct people to use the full command (eg python ./myfile)?


Viewing all articles
Browse latest Browse all 9738