close

how to run python files in windows command prompt?

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about how to run python files in windows command prompt in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

how to run python files in windows command prompt?

  1. how to run python files in windows command prompt?

    First go to the directory where your python script is present by using-
    cd path/to/directory

  2. run python files in windows command prompt

    First go to the directory where your python script is present by using-
    cd path/to/directory

Method 1

You have to install Python and add it to PATH on Windows. After that you can try:

python `C:/pathToFolder/prog.py`

or go to the files directory and execute:

python prog.py

Method 2

First go to the directory where your python script is present by using-

cd path/to/directory

then simply do:

python file_name.py

Summery

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read