How to run Python Script in Windows
![](https://pythonpoint.net/wp-content/uploads/2020/11/how-to-run-python-script-in-windows-1024x576.jpg)
A plain text file containing Python code that is intended to be directly executed by the user is called script. As you know python is a high level programming language. A file containing a python script has an extension of ‘.py’.
There are many ways to run a Python script in Windows.
- Interactive mode
- Command line
Interactive mode
In the Interactive Mode, you can run your script line by line in a sequence.
To enter an interactive mode, open Command Prompt on your Windows machine and type ‘python
’ and press Enter
.
![interactive mode demo](https://pythonpoint.net/wp-content/uploads/2020/11/interactive-mode-1024x294.jpg)
Now in this, you can run your python code line by line.
![interactive mode output](https://pythonpoint.net/wp-content/uploads/2020/11/interactive-mode-2-1024x510.jpg)
Using Command Line
To run a Python script stored in a ‘.py
’ file in the command line, we have to write ‘python
’ keyword before the file name in the command prompt.
Here, we are running a file named test.py in command line
python test.py
![command line](https://pythonpoint.net/wp-content/uploads/2020/11/Screenshot-2020-11-29-112600.jpg)