Name of font by powershell

Question:

I’m trying to write a Poweshell script that installs all fonts (in formats .ttf and .otf) from a given directory. However I want to ignore fonts that are already installed. For that purpose I need to get the names (not the filenames) of the fonts.

How can I do that?

Answer:

EDITED from comments from @LotPings

You can use .NET for that. In the following example you go through the list of files in a given path, then use the class PrivateFontCollection to retrieve the font names.

Source:

Name of font by powershell by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply