當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。