如何在XP中更改.py Python文件的文件关联?

8 python windows-xp cmd file-association

当我输入时,assoc .py我得到了.py=py_auto_file.当我输入时,ftype py_auto_file我得到了py_auto_file="C:\Program Files\Adobe\Photoshop 7.0\Photoshop.exe" "%1"

我怎么做py_auto_file="C:\Python27"

Mar*_*nen 17

Photoshop似乎可以识别.py文件格式,并将"py_auto_file"与.py扩展名相关联.

您可以使用以下命令来查找python文件类型:

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" %*
Run Code Online (Sandbox Code Playgroud)

下一个命令显示我系统中的正确关联:

C:\>assoc | findstr -i python
.py=Python.File
.pyc=Python.CompiledFile
.pyo=Python.CompiledFile
.pyw=Python.NoConFile
Run Code Online (Sandbox Code Playgroud)

您可以使用以下命令修复关联:

assoc .py=Python.File
assoc .pyc=Python.CompiledFile
assoc .pyo=Python.CompiledFile
assoc .pyw=Python.NoConFile
Run Code Online (Sandbox Code Playgroud)

  • 我认为只需将它们设置为空白:`ftype py_auto_file=`。您也可以通过“regedit.exe”直接在注册表中的“HKEY_CLASSES_ROOT”下删除它们。 (2认同)

And*_*lev 5

您应该将脚本名称%1和所有命令行参数%*传递给Python27可执行文件.为此,只需执行即可

ftype py_auto_file="C:\Python27\bin\python.exe" "%1" %*
Run Code Online (Sandbox Code Playgroud)