Compare commits

..

1 Commits

Author SHA1 Message Date
Typikal_Failman
bd601432f1
Merge d34a415dda into 87ee178546 2025-06-09 21:38:10 +07:00

View File

@ -3,30 +3,50 @@ chcp 65001 > nul
setlocal enabledelayedexpansion
:: Создаем временный файл для сортировки
:: Searching for .bat files in current folder, except files that start with "service"
echo Pick one of the options:
set "count=0"
set "tempfile=%temp%\%~n0_temp.txt"
if exist "%tempfile%" del "%tempfile%"
:: Счетчик файлов
set count=0
:: Собираем файлы с приоритетной сортировкой
for %%f in (*.bat) do (
if /i not "%%~nxf"=="launcher.bat" (
set "filename=%%~nxf"
set /a count+=1
echo !count!. %%f
set "file!count!=%%f"
set "name=%%f"
set "sortkey=5_%%f" :: По умолчанию - группа 5
:: Определяем приоритетные группы
if /i "!name!"=="general.bat" set "sortkey=1_!name!"
if /i "!name!" neq "general.bat" (
echo "!name!" | findstr /i /c:"general (ALT" >nul && set "sortkey=2_!name!"
echo "!name!" | findstr /i /c:"general (МГТС" >nul && set "sortkey=3_!name!"
if "!sortkey:~0,1!"=="5" (
echo "!name!" | findstr /i "general" >nul && set "sortkey=4_!name!"
)
)
:: Записываем во временный файл
echo !sortkey!>>"%tempfile%"
)
)
:: Choosing file
:input
set "choice="
set /p "choice=Input file index (number): "
if "!choice!"=="" goto :eof
set "selectedFile=!file%choice%!"
if not defined selectedFile (
echo Invalid choice, try again...
goto input
:: Проверяем наличие файлов
if not exist "%tempfile%" (
echo В директории нет других BAT-файлов.
pause
exit /b
)
:: Сортируем и выводим список
for /f "tokens=1* delims=_" %%a in ('sort "%tempfile%"') do (
set /a count+=1
set "file!count!=%%b"
echo [!count!] %%b
)
:: Удаляем временный файл
del "%tempfile%" >nul 2>&1
:: Блок ввода номера
:input
echo.