From 16a02dbc9840b5ab1406eeae2b77d6c638048ad2 Mon Sep 17 00:00:00 2001 From: Flamur Veliqi Date: Sat, 24 Jan 2026 16:45:59 +0000 Subject: [PATCH] batchr.bat aktualisiert --- batchr.bat | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/batchr.bat b/batchr.bat index 3912fe1..e2fc4a4 100644 --- a/batchr.bat +++ b/batchr.bat @@ -58,12 +58,23 @@ for /f "delims=" %%a in (%TEMP%\repo_scripts.txt) do ( set /a INDEX+=1 set "SCRIPT_NAME[!INDEX!]=!LINE!" - REM Format display name (remove .bat and replace separators) - set "DISPLAY=!LINE:.bat=!" - set "DISPLAY=!DISPLAY:-= !" - set "DISPLAY=!DISPLAY:_= !" + REM Reset title variable + set "SCRIPT_TITLE=" - echo [!INDEX!] !DISPLAY! + REM Extract title using PowerShell + set "SCRIPT_URL=https://git.weektab.org/companas/batchr/raw/branch/main/files/!LINE!" + + for /f "delims=" %%t in ('powershell -Command "$ProgressPreference = 'SilentlyContinue'; try { $content = (Invoke-WebRequest -Uri '!SCRIPT_URL!' -UseBasicParsing).Content; if ($content -match 'REM\s*===\s*(.+?)\s*===') { $matches[1] } else { '' } } catch { '' }"') do set "SCRIPT_TITLE=%%t" + + REM Fallback to formatted filename if title not found + if "!SCRIPT_TITLE!"=="" ( + set "SCRIPT_TITLE=!LINE:.bat=!" + set "SCRIPT_TITLE=!SCRIPT_TITLE:-= !" + set "SCRIPT_TITLE=!SCRIPT_TITLE:_= !" + ) + + set "DISPLAY[!INDEX!]=!SCRIPT_TITLE!" + echo [!INDEX!] !SCRIPT_TITLE! ) ) @@ -100,7 +111,7 @@ if "%VALID%"=="0" ( REM Execute script cls -echo /// Executing: !SCRIPT_NAME[%CHOICE%]! +echo /// Executing: !DISPLAY[%CHOICE%]! echo. set "SCRIPT_URL=https://git.weektab.org/companas/batchr/raw/branch/main/files/!SCRIPT_NAME[%CHOICE%]!"