0

I'm reading from a "bookazine" which I purchased from WHSmiths today and its said during the setup I need to type in these commands into the terminal (or the Command Prompt in my case) in order to make a script without needing to do it manually. One of these commands is chmod +x (file name) but because this is based of Linux or Mac and I am on Windows I am not sure how to make my script executable, how do I?

Thanks in advance.

Dan O
  • 6,022
  • 2
  • 32
  • 50

2 Answers2

1

In the Python documentation there is a small excerpt on this.

On Windows, the standard Python installer already associates the .py extension with a file type (Python.File) and gives that file type an open command that runs the interpreter (D:\Program Files\Python\python.exe "%1" %*). This is enough to make scripts executable from the command prompt as ‘foo.py’. If you’d rather be able to execute the script by simple typing ‘foo’ with no extension you need to add .py to the PATHEXT environment variable.

https://docs.python.org/2/faq/windows.html

Aside from that, like cricket_007 said, you can execute your scripts as

C:\User\YourName> python yourscript.py

Jon
  • 2,373
  • 1
  • 26
  • 34
  • Thank you! I was going to stay on a virtual machine with Ubuntu on it like cricket_007 said but now I am just needing to fix a couple things appearance wise I dont like about Atom, then I will stick with Windows. – Benjamin Colligan Apr 10 '17 at 01:53
0

You don't have shell scripts on Windows, you have batch or powershell.

If your reading is teaching Unix things, get a virtual machine running (insert popular Linux distribution here).

Regarding python, you just execute python script.py

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245