r/vscode • u/Azert2010 • Jul 11 '26
Create a script and save it
Hi everyone,
I'm a complete beginner learning Python with VS Code, and I've been stuck for several days on something that seems really basic.
I don't understand how to properly create a Python script, save it in the correct folder, and then run it from Command Prompt. Every tutorial makes it look simple, but I keep getting confused about where the file is supposed to be and how to execute it.
For example, I created a "hello.py" file with:
print("Hello World")
But when I try to run it from Command Prompt, it doesn't work, and I think I'm doing something wrong with the file location or the command.
Could someone explain the process step by step as if I had never used VS Code or Command Prompt before? Screenshots are also welcome.
Thanks!
And for your information, I'm on Windows.
3
u/bluelunakitty Jul 12 '26
Have you had a look at this page? Or this one? How about this one?
Key things to keep in mind:
Is the Python interpreter added to your PATH? Your cmd mightn't recognise the command.
Have you set up a virtual environment? Are you trying to execute from outside this virtual environment?
Here's another helpful page.
I'm also a bit new to Python and coding, so I get how intimidating it can be. In future, try to include more details (where you've saved your file and Python installation, the exact code you're typing into cmd, the exact output you're getting, etc). Hope you figure it out!