本文整理汇总了Python中winreg.HKEY_CLASSES_ROOT属性的典型用法代码示例。如果您正苦于以下问题:Python winreg.HKEY_CLASSES_ROOT属性的具体用法?Python winreg.HKEY_CLASSES_ROOT怎么用?Python winreg.HKEY_CLASSES_ROOT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类winreg
的用法示例。
在下文中一共展示了winreg.HKEY_CLASSES_ROOT属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: win_find_path
# 需要导入模块: import winreg [as 别名]
# 或者: from winreg import HKEY_CLASSES_ROOT [as 别名]
def win_find_path():
import winreg
reg = winreg.ConnectRegistry(None, winreg.HKEY_CLASSES_ROOT)
subkeys = [
r'Stata16Do\shell\do\command', r'Stata15Do\shell\do\command',
r'Stata14Do\shell\do\command', r'Stata13Do\shell\do\command',
r'Stata12Do\shell\do\command']
fpath = ''
for subkey in subkeys:
try:
key = winreg.OpenKey(reg, subkey)
fpath = winreg.QueryValue(key, None).split('"')[1]
except FileNotFoundError:
pass
if fpath:
break
return fpath
示例2: cmder_setup
# 需要导入模块: import winreg [as 别名]
# 或者: from winreg import HKEY_CLASSES_ROOT [as 别名]
def cmder_setup():
global CMDER_SETUP
if CMDER_SETUP:
return
try:
akey = winreg.OpenKey(
winreg.HKEY_CLASSES_ROOT, "Directory\\shell\\Cmder\\command", 0, winreg.KEY_READ)
command = winreg.QueryValueEx(akey, "")[0]
conemu_base_dir = os.path.join(
RE_CMDER.match(command).group(1), "vendor", "conemu-maximus5", "ConEmu")
if os.path.exists(conemu_base_dir):
if conemu_base_dir not in os.environ["PATH"]:
os.environ["PATH"] = conemu_base_dir + ";" + os.environ["PATH"]
CMDER_SETUP = True
except Exception:
return
示例3: conemu_setup
# 需要导入模块: import winreg [as 别名]
# 或者: from winreg import HKEY_CLASSES_ROOT [as 别名]
def conemu_setup():
global CONEMU_SETUP
if CONEMU_SETUP:
return
try:
akey = winreg.OpenKey(
winreg.HKEY_CLASSES_ROOT, "Directory\\shell\\ConEmu Here\\command", 0, winreg.KEY_READ)
command = winreg.QueryValueEx(akey, "")[0]
conemu_base_dir = os.path.join(RE_CONEMU.match(command).group(1), "ConEmu")
if os.path.exists(conemu_base_dir):
if conemu_base_dir not in os.environ["PATH"]:
os.environ["PATH"] = conemu_base_dir + ";" + os.environ["PATH"]
CONEMU_SETUP = True
except Exception:
return
示例4: __init__
# 需要导入模块: import winreg [as 别名]
# 或者: from winreg import HKEY_CLASSES_ROOT [as 别名]
def __init__(self, update_statuses):
self._WIN_REG_SHELL = (winreg.HKEY_CLASSES_ROOT, r"battlenet\shell\open\command")
super().__init__(update_statuses)
self.uninstaller = self.set_uninstaller()
self._exe = self._find_exe()