I have the output of a command
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts"
which I need to:
1) Filter to include only TrueType fonts
2) Shorten down the output to only include the font's name (everything up to the "(TrueType)")
Is it possible to do this, and if so, how?
I've already tried using
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" |
findstr /I /C:"(TrueType)"
and got the output
Arial (TrueType) REG_SZ arial.ttf
Arial Black (TrueType) REG_SZ ariblk.ttf
Arial Bold (TrueType) REG_SZ arialbd.ttf
Arial Bold Italic (TrueType) REG_SZ arialbi.ttf
Arial Italic (TrueType) REG_SZ ariali.ttf
ect.
but from there I couldn't figure out how to omit the filenames and the "REG_SZ" text. I tried setting them all to variables with help from this post
SETLOCAL ENABLEDELAYEDEXPANSION
SET count=1
FOR /F "tokens=* USEBACKQ" %%F IN (`reg query
"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" |
findstr /I /C:"(TrueType)"`) DO (
SET var!count!=%%F
SET /a count=!count!+1
)
ECHO %var1%
ECHO %var2%
ECHO %var3%
ENDLOCAL
But again, this wouldn't work because each computer has a different amount of fonts, so there's no set amount of variables to assign. Also, the files for each font have different amounts of characters in the filename, so using
echo %var1:~,-X%
wouldn't work, nor would the opposite
echo %var1:~,X%
So ultimately, I'm back to square one with
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" |
findstr /I /C:"(TrueType)"
Is there any way to achieve the outcome I need?