Skip to content

Instantly share code, notes, and snippets.

@shadow443
Created April 3, 2021 05:52
Show Gist options
  • Save shadow443/d946b2dee3829dec359774cba44f0e2f to your computer and use it in GitHub Desktop.
Save shadow443/d946b2dee3829dec359774cba44f0e2f to your computer and use it in GitHub Desktop.
Associate *.py files with Python (Windows) (Raw Text)
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