Reputation: 97
I'm trying to launch a python script on windows command prompt, but instead of it doing it, it opens the script on vscode instead. I searched the options in vscode and didn't find anything. How can I stop this behavior?
SOLVED
I simply changed the default program for .py
files
Upvotes: 4
Views: 7006
Reputation: 11151
You need to change the default application for .py
files to python.exe
.
This will instruct Windows to pass the filename of the python script you're trying to open to python.exe
, which will execute it.
python my_script.py
As a bonus, if you change the PATHEXT
environment variable to include .py
extension. This will allow you to run a python script without prefixing it with python
command when working in a shell.
./my_script.py
Python installer does this by default, but if it isn't there, you can add it.
Upvotes: 5