From d68879e6d89297b85e5a29aee7dbde0d2820fca7 Mon Sep 17 00:00:00 2001 From: Typikal_Failman Date: Mon, 9 Jun 2025 19:29:59 +0500 Subject: [PATCH 1/3] Create launcher.bat Adding laucher.bat for create shortcut to fast change of configure. Usable for laptops rapidly moved between different Internet providers. --- launcher.bat | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 launcher.bat diff --git a/launcher.bat b/launcher.bat new file mode 100644 index 0000000..14b38f1 --- /dev/null +++ b/launcher.bat @@ -0,0 +1,69 @@ +@echo off +chcp 65001 > nul +setlocal enabledelayedexpansion + +:: Создаем временный файл для сортировки +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 "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%" + ) +) + +:: Проверяем наличие файлов +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. +set /p "choice=Введите номер файла (1-%count%): " +echo. + +:: Проверка корректности ввода +set valid=0 +for /l %%i in (1,1,%count%) do if "!choice!"=="%%i" set valid=1 + +if !valid! equ 0 ( + echo Ошибка: неверный номер. Введите число от 1 до %count%. + goto input +) + +:: Запуск выбранного файла +echo Запускаем файл: !file%choice%! +call "!file%choice%!" + +endlocal From d34a415ddaa6d6d515e22664bc04ce75f77703fd Mon Sep 17 00:00:00 2001 From: Typikal_Failman Date: Mon, 9 Jun 2025 19:38:08 +0500 Subject: [PATCH 2/3] Update launcher.bat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Убрал не нужный endlocal. --- launcher.bat | 2 -- 1 file changed, 2 deletions(-) diff --git a/launcher.bat b/launcher.bat index 14b38f1..25fd001 100644 --- a/launcher.bat +++ b/launcher.bat @@ -65,5 +65,3 @@ if !valid! equ 0 ( :: Запуск выбранного файла echo Запускаем файл: !file%choice%! call "!file%choice%!" - -endlocal From e4b4ac765423b2afeee82f06da0f022a12b91a1a Mon Sep 17 00:00:00 2001 From: Typikal_Failman Date: Tue, 10 Jun 2025 14:42:10 +0500 Subject: [PATCH 3/3] Update launcher.bat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Убрал сортировку. --- launcher.bat | 52 ++++++++++++++++------------------------------------ 1 file changed, 16 insertions(+), 36 deletions(-) diff --git a/launcher.bat b/launcher.bat index 25fd001..2ab769c 100644 --- a/launcher.bat +++ b/launcher.bat @@ -3,50 +3,30 @@ chcp 65001 > nul setlocal enabledelayedexpansion :: Создаем временный файл для сортировки -set "tempfile=%temp%\%~n0_temp.txt" -if exist "%tempfile%" del "%tempfile%" - -:: Счетчик файлов -set count=0 - -:: Собираем файлы с приоритетной сортировкой +:: Searching for .bat files in current folder, except files that start with "service" +echo Pick one of the options: +set "count=0" for %%f in (*.bat) do ( if /i not "%%~nxf"=="launcher.bat" ( - 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%" + set "filename=%%~nxf" + set /a count+=1 + echo !count!. %%f + set "file!count!=%%f" ) ) -:: Проверяем наличие файлов -if not exist "%tempfile%" ( - echo В директории нет других BAT-файлов. - pause - exit /b -) +:: Choosing file +:input +set "choice=" +set /p "choice=Input file index (number): " +if "!choice!"=="" goto :eof -:: Сортируем и выводим список -for /f "tokens=1* delims=_" %%a in ('sort "%tempfile%"') do ( - set /a count+=1 - set "file!count!=%%b" - echo [!count!] %%b +set "selectedFile=!file%choice%!" +if not defined selectedFile ( + echo Invalid choice, try again... + goto input ) -:: Удаляем временный файл -del "%tempfile%" >nul 2>&1 - :: Блок ввода номера :input echo.