srcpath=H:\PostInstall. There are 26 ttf files in the folder.
I have some fonts that are already installed and some that aren't.
I've just set it up with echo atm so I can see what's happening.
original code
Code: Select all
for %%a in ("%SrcPath%\Fonts\*.?tf") do call :installfont %%~na
Goto L1234
:Installfont
if exist "%windir%\fonts\%%a" echo Font %%a already installed.
if not exist "%windir%\fonts\%%a" (
echo Processing font %%a
Echo copy %%a "%windir%\fonts"
set fext=%%a:~-3%
if /i "%fext%"=="ttf" set ftype=(Truetype)
if /i "%fext%"=="otf" set ftype=(Opentype)
echo reg add "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Fonts" /v %%a %ftype% /d %%a /type REG_SZ /d
)
exit /b
:L1234
...Rest of script
Code: Select all
@Echo Off
set srcpath="H:\PostInstall"
for %%a in ("%SrcPath%\Fonts\*.?tf") do call :installfont %%~nxa
Goto L1234
:Installfont
Set font=%~1
if exist "%windir%\fonts\%font%" echo Font %font% already installed.
if not exist "%windir%\fonts\%font%" (
Echo copy %font% to "%windir%\fonts"
set fext=%font:~-3%
echo Processing font %font% Extension: %fext%
if /i "%fext%"=="ttf" set "ftype=(Truetype)"
if /i "%fext%"=="otf" set "ftype=(Opentype)"
echo reg add "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Fonts" /v "%font% %ftype%" /d %font% /t REG_SZ /f
set fext=
)
exit /b
:L1234
Echo Done