batchr.bat aktualisiert
This commit is contained in:
26
batchr.bat
26
batchr.bat
@@ -50,25 +50,24 @@ if "%FIRST_LINE%"=="NONE" (
|
|||||||
exit /b 1
|
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
|
REM Display menu
|
||||||
set INDEX=0
|
set INDEX=0
|
||||||
for /f "delims=" %%a in (%TEMP%\repo_scripts.txt) do (
|
for /f "tokens=1,2 delims=|" %%a in (%TEMP%\repo_titles.txt) do (
|
||||||
set "LINE=%%a"
|
set "FILENAME=%%a"
|
||||||
if not "!LINE!"=="" (
|
set "SCRIPT_TITLE=%%b"
|
||||||
|
|
||||||
|
if not "!FILENAME!"=="" (
|
||||||
set /a INDEX+=1
|
set /a INDEX+=1
|
||||||
set "SCRIPT_NAME[!INDEX!]=!LINE!"
|
set "SCRIPT_NAME[!INDEX!]=!FILENAME!"
|
||||||
|
|
||||||
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"
|
|
||||||
|
|
||||||
REM Fallback to formatted filename if title not found
|
REM Fallback to formatted filename if title not found
|
||||||
if "!SCRIPT_TITLE!"=="" (
|
if "!SCRIPT_TITLE!"=="" (
|
||||||
set "SCRIPT_TITLE=!LINE:.bat=!"
|
set "SCRIPT_TITLE=!FILENAME:.bat=!"
|
||||||
set "SCRIPT_TITLE=!SCRIPT_TITLE:-= !"
|
set "SCRIPT_TITLE=!SCRIPT_TITLE:-= !"
|
||||||
set "SCRIPT_TITLE=!SCRIPT_TITLE:_= !"
|
set "SCRIPT_TITLE=!SCRIPT_TITLE:_= !"
|
||||||
)
|
)
|
||||||
@@ -145,6 +144,7 @@ goto MENU
|
|||||||
:EXIT
|
:EXIT
|
||||||
if exist "%TEMP%\repo_readme.md" del "%TEMP%\repo_readme.md" 2>nul
|
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_scripts.txt" del "%TEMP%\repo_scripts.txt" 2>nul
|
||||||
|
if exist "%TEMP%\repo_titles.txt" del "%TEMP%\repo_titles.txt" 2>nul
|
||||||
cls
|
cls
|
||||||
echo Goodbye!
|
echo Goodbye!
|
||||||
timeout /t 1 >nul
|
timeout /t 1 >nul
|
||||||
|
|||||||
Reference in New Issue
Block a user