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