ファイルの拡張子を Windows CE のプログラムに関連付けるにはどうすればよいですか? cmdを使用して Python プログラムを実行するのはとても退屈です。Python を **.py* ファイルに関連付けると、プログラムの実行速度が向上します。ありがとう!
2197 次
1 に答える
0
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)
これはコードです。必要に応じて、これを使用して他のプログラムや他の拡張機能に関連付けることができます。
于 2009-07-05T12:41:31.170 に答える