I have a directory with fonts, say C:\fonts Inside the directory there are others directories where the fonts are sorted alphabetically, like A B C D .. Z. What I want to do with the batch is to copy fonts randomly from the different directories A-Z to the system fonts directory (%systemroot\fonts). I want to be able to specify a range number of fonts that batch script will be copying, like from 20 to 30 as example. Current script do the work, except it copies just 30 fonts. Also, my biggest problem is...the script is quite slow to do the copy. I was wondering if it's possible to optimize it somehow for a faster work???!!!
Here is the script:
setlocal EnableExtensions EnableDelayedExpansion
for /f %%A in ('dir *.* /a:-d /s ^| find "File(s)"') do set "xCount=%%~A"
set /a "xIndex=%Random% %% %xCount%"
for /f "delims=" %%A in ('dir *.* /a:-d /b /s') do (
if "!xTally!" EQU "%xIndex%" (
xcopy "%%~fA" "%systemroot%\fonts" /Y
set /a "xTally+=1"
set /a executecounter=%executecounter%+1
if "%executecounter%"=="30" goto done