Run a Python file in Command Prompt

How to run a Python file in Windows Command Prompt using the imput command?

You can’t. But look at the subprocess module, which allows to run pretty much anything.

Can you elaborate a bit on what you mean here?

IIRC on Windows the Python interpreter is invoked as “py”, so:


would be my first guess.

Cameron Simpson

It’s not clear what you mean by this, because “using the imput command” doesn’t make sense. There are a few things that I could guess you are trying to say, but the answer would be very different depending on that.

I think by “input command” OP meant the command prompt (as in the question title). @cameron’s answer is my guess.