From 79703d05d35ab9227079324e5ad800a991c6c3af Mon Sep 17 00:00:00 2001 From: Flamur Veliqi Date: Sat, 24 Jan 2026 16:53:02 +0000 Subject: [PATCH] batchr.bat aktualisiert --- batchr.bat | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/batchr.bat b/batchr.bat index e2fc4a4..f1d8594 100644 --- a/batchr.bat +++ b/batchr.bat @@ -50,25 +50,24 @@ if "%FIRST_LINE%"=="NONE" ( exit /b 1 ) +REM Get all script titles in one PowerShell call +echo Extracting list... +echo. +powershell -Command "$ProgressPreference = 'SilentlyContinue'; try { $files = Get-Content '%TEMP%\repo_scripts.txt'; $results = @(); foreach ($file in $files) { if ($file -and $file -ne '' -and $file -ne 'NONE' -and $file -ne 'ERROR') { try { $url = 'https://git.weektab.org/companas/batchr/raw/branch/main/files/' + $file; $content = (Invoke-WebRequest -Uri $url -UseBasicParsing).Content; if ($content -match 'REM\s*===\s*(.+?)\s*===') { $results += $file + '|' + $matches[1] } else { $results += $file + '|' } } catch { $results += $file + '|' } } }; $results | Out-File '%TEMP%\repo_titles.txt' -Encoding ASCII } catch { }" 2>nul + REM Display menu set INDEX=0 -for /f "delims=" %%a in (%TEMP%\repo_scripts.txt) do ( - set "LINE=%%a" - if not "!LINE!"=="" ( +for /f "tokens=1,2 delims=|" %%a in (%TEMP%\repo_titles.txt) do ( + set "FILENAME=%%a" + set "SCRIPT_TITLE=%%b" + + if not "!FILENAME!"=="" ( set /a INDEX+=1 - set "SCRIPT_NAME[!INDEX!]=!LINE!" - - REM Reset title variable - set "SCRIPT_TITLE=" - - 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" + set "SCRIPT_NAME[!INDEX!]=!FILENAME!" REM Fallback to formatted filename if title not found if "!SCRIPT_TITLE!"=="" ( - set "SCRIPT_TITLE=!LINE:.bat=!" + set "SCRIPT_TITLE=!FILENAME:.bat=!" set "SCRIPT_TITLE=!SCRIPT_TITLE:-= !" set "SCRIPT_TITLE=!SCRIPT_TITLE:_= !" ) @@ -145,6 +144,7 @@ goto MENU :EXIT if exist "%TEMP%\repo_readme.md" del "%TEMP%\repo_readme.md" 2>nul if exist "%TEMP%\repo_scripts.txt" del "%TEMP%\repo_scripts.txt" 2>nul +if exist "%TEMP%\repo_titles.txt" del "%TEMP%\repo_titles.txt" 2>nul cls echo Goodbye! timeout /t 1 >nul