How do you change file association for .py Python files in XP?

倖福魔咒の 提交于 2019-11-30 06:48:20

问题


When I type assoc .py I get .py=py_auto_file. When I type ftype py_auto_file I get py_auto_file="C:\Program Files\Adobe\Photoshop 7.0\Photoshop.exe" "%1"

How do I make py_auto_file="C:\Python27"?


回答1:


It appears Photoshop may recognize a .py file format and has associated "py_auto_file" with the .py extension.

You can use the following command to locate the python file types:

C:\>ftype | findstr -i python
Python.CompiledFile="C:\Python27\python.exe" "%1" %*
Python.File="C:\Python27\python.exe" "%1" %*
Python.NoConFile="C:\Python27\pythonw.exe" "%1" %*

The next command shows the correct associations from my system:

C:\>assoc | findstr -i python
.py=Python.File
.pyc=Python.CompiledFile
.pyo=Python.CompiledFile
.pyw=Python.NoConFile

You can fix the associations with the following commands:

assoc .py=Python.File
assoc .pyc=Python.CompiledFile
assoc .pyo=Python.CompiledFile
assoc .pyw=Python.NoConFile



回答2:


You should pass script name %1 and all command-line parameters %* to Python27 executable. To do this, simply execute

ftype py_auto_file="C:\Python27\bin\python.exe" "%1" %*



回答3:


Right-click on .py file and set default program as python.exe



来源:https://stackoverflow.com/questions/8196314/how-do-you-change-file-association-for-py-python-files-in-xp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!