-1

I was trying to run the python file in the windows command prompt, and I used the command "test.py", with the double quotes in the command.

The file was opened as a .txt file with the codes I wrote in it instead of running like a program.

I have put the file on the desktop.

I am very new to coding. Can someone help me with how to run python file from windows cmd prompt?

Shadab Hussain
  • 794
  • 6
  • 24
Xinyu
  • 1
  • You can look for the solution [here](https://stackoverflow.com/questions/4621255/how-do-i-run-a-python-program-in-the-command-prompt-in-windows-7) – Shadab Hussain Apr 01 '20 at 03:31
  • Does this answer your question? [How do I run a Python program in the Command Prompt in Windows 7?](https://stackoverflow.com/questions/4621255/how-do-i-run-a-python-program-in-the-command-prompt-in-windows-7) – Alex_P Apr 01 '20 at 10:33

2 Answers2

0

Have you tried running

python "/path/to/file.py"?

For python 3, you may have to use

python3 "/path/to/file.py"

3NiGMa
  • 545
  • 1
  • 9
  • 24
0

Instead of writing:

"test.py"

Use

python test.py
RMPR
  • 3,368
  • 4
  • 19
  • 31