0
如何将文件的扩展名与Windows CE中的程序关联?使用cmd运行我的Python程序非常无聊。如果我将Python与我的** .py *文件相关联,我将更快地运行我的程序。谢谢!Windows CE中的关联扩展
如何将文件的扩展名与Windows CE中的程序关联?使用cmd运行我的Python程序非常无聊。如果我将Python与我的** .py *文件相关联,我将更快地运行我的程序。谢谢!Windows CE中的关联扩展
我正在寻找下我的Windows CE Python的文件,我发现了一个简单的代码来做到这一点,我调整了它是更好:
#
# Setup the registry to allow us to double click on python scripts
#
from _winreg import *
print "Setting up registry to allow\ndouble clicking of Python files to work"
#
# Create the registry entries for ".py" and ".pyc" extensions
#
for Name in (".py", ".pyc"):
Key = CreateKey(HKEY_CLASSES_ROOT, Name)
SetValue(Key, None, REG_SZ, "Python.File")
CloseKey(Key)
#
# Create HKEY_CLASSES_ROOT\Python.File\Shell\Open\Command = "\Program Files\Python\Lib\Python.exe" "%1"
#
Key = CreateKey(HKEY_CLASSES_ROOT, "Python.File")
for Name in ("Shell","Open","Command"):
New_Key= CreateKey(Key, Name)
CloseKey(Key)
Key = New_Key
SetValue(Key, None, REG_SZ, "\"\\Program Files\\Python\\Lib\\Python.exe\" \"%1\"")
CloseKey(Key)
import time
time.sleep(5)
这是代码,如果你愿意,你可以用它来关联到其他程序和其他扩展。
你是如何调整它使其“更好”?它只是设置一个注册表键... – Cogsy 2009-07-05 13:07:38