Created
April 3, 2021 05:52
-
-
Save shadow443/d946b2dee3829dec359774cba44f0e2f to your computer and use it in GitHub Desktop.
Associate *.py files with Python (Windows) (Raw Text)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Associate *.py files with python | |
Run the following commands at a shell prompt: | |
assoc .py=PythonScript | |
ftype PythonScript=C:\bin\python.exe "%1" %* | |
Replace C:\Python\bin\python.exe with the path to your Python installation. This enables you to run myscript.py instead of python myscript.py | |
Add .py to your PATHEXT environment variable: | |
This makes Windows consider *.py files to be executable when searching your PATH. It enables you to run myscript instead of myscript.py | |
You can set it for the current cmd session: | |
set PATHEXT=%PATHEXT%;.PY | |
To set it permanently (under Windows Vista or Windows 7): | |
setx PATHEXT %PATHEXT%;.PY |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment