Код:

@echo off
setlocal enabledelayedexpansion
set Default.bar=C:\Program Files\Total Commander\Default.bar
set TeraCopy=C:\Program Files\TeraCopy\
for %%i in ("1 Copy" "2 Move") do (
for /f "tokens=1,2" %%j in (%%i) do (
(
findstr /irxc:"button[0-9]*=%TeraCopy:\=\\%teracopy\.exe,%%j"^
"%Default.bar%">nul
)|| (
for /f "usebackq tokens=1* delims==" %%l in ("%Default.bar%") do (
set /a n+=1
if not "%%m"=="" (
if %%l==Buttoncount (
set /a Buttoncount=%%m+1
set "!n!=%%l=!Buttoncount!"
) else (
set "!n!=%%l=%%m"
set "last_menu=%%l"
set /a next_number=!last_menu:menu=!+1
)
) else (
set "!n!=%%l"
)
)
(
for /l %%l in (1 1 !n!) do (
echo.!%%l!
)
set n=
for %%l in (
"button!next_number!=%TeraCopy%teracopy.exe,%%j"
"cmd!next_number!=%TeraCopy%teracopy.exe"
"param!next_number!=%%k #$%%L$ $%%T$"
"path!next_number!=%TeraCopy%"
"menu!next_number!=Tera%%k"
) do (
set string=%%~l
set string=!string:$="!
echo !string:#=*!
)
)>"%Default.bar%"
)
)
)
endlocal
exit /b