How to run a python program in Windows 10 command prompt

Viewed 1354

I am getting as such error for executing my hello world program:

"This file does not have a program associated with it for performing this action"

execution attempt screenshot

2 Answers

1) Download the official version of Python

2) Use custom installation following the screenshots bellow.

3) Run your hello.py file directly from the command line by typing hello.py

  • Screenshots #1

enter image description here

  • Screenshots #2

enter image description here

  • Screenshots #3

enter image description here


  • I have this python code that I'm running on just by typing Q60471933.py
from datetime import datetime
print("\nHello World\n",datetime.now().strftime("\b%m/%d/%Y\n%H:%M:%S"))

  • Outputs: enter image description here

Try this in your command prompt:

python3 hello.py
Related