---
title: "How to get a list of installed windows fonts using python?"  
description: "How to get a list of installed windows fonts using python?"  
author: "Revati S Misra"  
published: 2023-07-25  
updated: 2023-07-25  
canonical: https://www.mindstick.com/forum/159268/how-to-get-a-list-of-installed-windows-fonts-using-python  
category: "python"  
tags: ["windows", "python", "font"]  
reading_time: 1 minute  

---

# How to get a list of installed windows fonts using python?

How to get a list of installed [Windows](https://www.mindstick.com/articles/311752/how-to-install-and-use-the-google-wifi-software-on-a-windows-or-mac-computer) fonts using [Python](https://www.mindstick.com/articles/75378/simple-yet-useful-tips-when-using-python)?

## Replies

### Reply by Aryan Kumar

Sure, here is how you can get a list of installed Windows fonts using Python:

Python

```plaintext
import winreg

def get_installed_fonts():
  """Gets a list of installed Windows fonts."""
  fonts = []

  # Get the registry key for the installed fonts.
  key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts")

  # Enumerate the values in the registry key.
  for value in winreg.EnumKey(key, 0):
    font_path = winreg.QueryValueEx(key, value)[0]

    # Add the font to the list.
    fonts.append(font_path)

  return fonts

if __name__ == "__main__":
  fonts = get_installed_fonts()
  for font in fonts:
    print(font)
```

This code will first import the `winreg` module, which is used to access the Windows registry. Then, it will define a function called `get_installed_fonts()`. This function will get the registry key for the installed fonts and enumerate the values in the key. For each value, it will get the font path and add it to a list. Finally, the function will return the list of fonts.

The `get_installed_fonts()` function can be called from the main body of the program. This will print a list of all the installed Windows fonts to the console.


---

Original Source: https://www.mindstick.com/forum/159268/how-to-get-a-list-of-installed-windows-fonts-using-python

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
