batchr.bat aktualisiert

This commit is contained in:
2026-01-24 16:53:02 +00:00
parent 0beaa7e496
commit 79703d05d3

View File

@@ -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