当前位置: 首页>>代码示例>>Python>>正文


Python winreg.QueryValue方法代码示例

本文整理汇总了Python中winreg.QueryValue方法的典型用法代码示例。如果您正苦于以下问题:Python winreg.QueryValue方法的具体用法?Python winreg.QueryValue怎么用?Python winreg.QueryValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在winreg的用法示例。


在下文中一共展示了winreg.QueryValue方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _find_chrome_win

# 需要导入模块: import winreg [as 别名]
# 或者: from winreg import QueryValue [as 别名]
def _find_chrome_win():
    import winreg as reg
    reg_path = r'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe'

    for install_type in reg.HKEY_CURRENT_USER, reg.HKEY_LOCAL_MACHINE:
        try:
            reg_key = reg.OpenKey(install_type, reg_path, 0, reg.KEY_READ)
            chrome_path = reg.QueryValue(reg_key, None)
            reg_key.Close()
            if not os.path.isfile(chrome_path):
                continue
        except WindowsError:
            chrome_path = None
        else:
            break

    return chrome_path 
开发者ID:samuelhwilliams,项目名称:Eel,代码行数:19,代码来源:chrome.py

示例2: win_find_path

# 需要导入模块: import winreg [as 别名]
# 或者: from winreg import QueryValue [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 
开发者ID:kylebarron,项目名称:stata_kernel,代码行数:21,代码来源:utils.py

示例3: getGenerateScript

# 需要导入模块: import winreg [as 别名]
# 或者: from winreg import QueryValue [as 别名]
def getGenerateScript(self):
		
		# Under Windows, GenerateProjectFiles.bat only exists for source builds of the engine
		batFile = self.getEngineRoot() + '\\Engine\\Build\\BatchFiles\\GenerateProjectFiles.bat'
		if os.path.exists(batFile):
			return batFile
		
		# For versions of the engine installed using the launcher, we need to query the shell integration
		# to determine the location of the Unreal Version Selector executable, which generates VS project files
		try:
			key = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, 'Unreal.ProjectFile\\shell\\rungenproj\\command')
			if key:
				command = winreg.QueryValue(key, None)
				if len(command) > 0:
					
					# Write the command to run UnrealVersionSelector.exe to our own batch file
					customBat = os.path.join(self._customBatchScriptDir(), 'GenerateProjectFiles.bat')
					Utility.writeFile(customBat, command.replace('"%1"', '%1') + '\r\n')
					return customBat
		except:
			pass
		
		raise UnrealManagerException('could not detect the location of GenerateProjectFiles.bat or UnrealVersionSelector.exe.\nThis typically indicates that .uproject files are not correctly associated with UE4.') 
开发者ID:adamrehn,项目名称:ue4cli,代码行数:25,代码来源:UnrealManagerWindows.py

示例4: _find_edge_win

# 需要导入模块: import winreg [as 别名]
# 或者: from winreg import QueryValue [as 别名]
def _find_edge_win():
    import winreg as reg
    reg_path = r'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\msedge.exe'

    for install_type in reg.HKEY_CURRENT_USER, reg.HKEY_LOCAL_MACHINE:
        try:
            reg_key = reg.OpenKey(install_type, reg_path, 0, reg.KEY_READ)
            edge_path = reg.QueryValue(reg_key, None)
            reg_key.Close()
            if not os.path.isfile(edge_path):
                continue
        except WindowsError:
            edge_path = None
        else:
            break

    return edge_path 
开发者ID:julesontheroad,项目名称:NSC_BUILDER,代码行数:19,代码来源:edge.py

示例5: get_registry_app_path

# 需要导入模块: import winreg [as 别名]
# 或者: from winreg import QueryValue [as 别名]
def get_registry_app_path(key,filename):
	if not winreg:
		return None
	try:
		result=winreg.QueryValue(key,"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\%s.exe"%filename[0])
	except WindowsError:
		pass
	else:
		if os.path.isfile(result):
			return result 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:12,代码来源:Utils.py

示例6: get_browser_path

# 需要导入模块: import winreg [as 别名]
# 或者: from winreg import QueryValue [as 别名]
def get_browser_path():
    paths_dict = {}
    for name in BROWSER_PATH:
        handler = winreg.OpenKey(
            winreg.HKEY_LOCAL_MACHINE, BROWSER_PATH[name], access=winreg.KEY_READ)
        abs_path = winreg.QueryValue(handler, None)
        # print(abs_path)
        paths_dict[name] = abs_path
    return paths_dict 
开发者ID:wechat-tests,项目名称:PyMicroChat,代码行数:11,代码来源:get_win_browser.py

示例7: find_chrome_win

# 需要导入模块: import winreg [as 别名]
# 或者: from winreg import QueryValue [as 别名]
def find_chrome_win():
  import winreg as reg
  reg_path = r'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe'

  for install_type in reg.HKEY_LOCAL_MACHINE, reg.HKEY_CURRENT_USER:
    try:
      reg_key = reg.OpenKey(install_type, reg_path, 0, reg.KEY_READ)
      chrome_path = reg.QueryValue(reg_key, None)
      reg_key.Close()
    except WindowsError:
      pass

  return chrome_path 
开发者ID:tydesk,项目名称:tydesk,代码行数:15,代码来源:browsers.py

示例8: find_firefox_win

# 需要导入模块: import winreg [as 别名]
# 或者: from winreg import QueryValue [as 别名]
def find_firefox_win():
  import winreg as reg
  reg_path = r'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe'

  for install_type in reg.HKEY_LOCAL_MACHINE, reg.HKEY_CURRENT_USER:
    try:
      reg_key = reg.OpenKey(install_type, reg_path, 0, reg.KEY_READ)
      firefox_path = reg.QueryValue(reg_key, None)
      reg_key.Close()
    except WindowsError:
      pass

  return firefox_path 
开发者ID:tydesk,项目名称:tydesk,代码行数:15,代码来源:browsers.py

示例9: _get_interpreters_from_windows_registry

# 需要导入模块: import winreg [as 别名]
# 或者: from winreg import QueryValue [as 别名]
def _get_interpreters_from_windows_registry(self):
        # https://github.com/python/cpython/blob/master/Tools/msi/README.txt
        import winreg

        result = set()
        for key in [winreg.HKEY_LOCAL_MACHINE, winreg.HKEY_CURRENT_USER]:
            for version in [
                "3.5",
                "3.5-32",
                "3.5-64",
                "3.6",
                "3.6-32",
                "3.6-64",
                "3.7",
                "3.7-32",
                "3.7-64",
                "3.8",
                "3.8-32",
                "3.8-64",
            ]:
                try:
                    for subkey in [
                        "SOFTWARE\\Python\\PythonCore\\" + version + "\\InstallPath",
                        "SOFTWARE\\Python\\PythonCore\\Wow6432Node\\" + version + "\\InstallPath",
                    ]:
                        dir_ = winreg.QueryValue(key, subkey)
                        if dir_:
                            path = os.path.join(dir_, WINDOWS_EXE)
                            if os.path.exists(path):
                                result.add(path)
                except Exception:
                    pass

        return result 
开发者ID:thonny,项目名称:thonny,代码行数:36,代码来源:running_config_page.py

示例10: find_makensis_win

# 需要导入模块: import winreg [as 别名]
# 或者: from winreg import QueryValue [as 别名]
def find_makensis_win():
    """Locate makensis.exe on Windows by querying the registry"""
    try:
        nsis_install_dir = winreg.QueryValue(
            winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\NSIS"
        )
    except OSError:
        nsis_install_dir = winreg.QueryValue(
            winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\NSIS"
        )

    return pjoin(nsis_install_dir, "makensis.exe") 
开发者ID:mu-editor,项目名称:mu,代码行数:14,代码来源:mu_nsist.py

示例11: find_chrome_win

# 需要导入模块: import winreg [as 别名]
# 或者: from winreg import QueryValue [as 别名]
def find_chrome_win(self):
        import winreg as reg
        reg_path = r'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe'

        for install_type in reg.HKEY_CURRENT_USER, reg.HKEY_LOCAL_MACHINE:
            try:
                reg_key = reg.OpenKey(install_type, reg_path, 0, reg.KEY_READ)
                chrome_path = reg.QueryValue(reg_key, None)
                reg_key.Close()
            except WindowsError:
                chrome_path = None
            else:
                break

        return chrome_path 
开发者ID:ClimenteA,项目名称:flaskwebgui,代码行数:17,代码来源:flaskwebgui.py


注:本文中的winreg.QueryValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。