RDP / download-server-tools.bat
bucky02's picture
Upload 2 files
2ef2e07 verified
Raw History Blame Contribute Delete
4.11 kB
@echo off
setlocal EnableExtensions
title Download Server Tools (MariaDB / HeidiSQL / WinRAR)
REM ============================================================
REM New RDP setup - downloads the 3 tools automatically.
REM 1) MariaDB 12.3.3 x64 (.msi)
REM 2) HeidiSQL 12.21 (.exe)
REM 3) WinRAR 64-bit latest (.exe)
REM No admin needed to DOWNLOAD. Admin is needed to INSTALL.
REM ============================================================
set "DEST=%USERPROFILE%\Desktop\Server-Tools"
if not exist "%DEST%" mkdir "%DEST%"
set "OK=0"
set "BAD=0"
echo.
echo Saving to: %DEST%
echo ------------------------------------------------------------
call :Get "https://mirrors.aliyun.com/mariadb//mariadb-12.3.3/winx64-packages/mariadb-12.3.3-winx64.msi" "%DEST%\mariadb-12.3.3-winx64.msi" "MariaDB 12.3.3 x64"
call :Get "https://github.com/HeidiSQL/HeidiSQL/releases/download/v12.21/HeidiSQL_12.21.0.7344_Setup.exe" "%DEST%\HeidiSQL_12.21.0.7344_Setup.exe" "HeidiSQL 12.21"
REM WinRAR: the win-rar.com page you had is not a direct file link.
REM These are the official direct URLs - newest version first.
set "WRDONE="
for %%V in (721 720 713 712 711 710) do (
if not defined WRDONE (
call :TryWinrar %%V
if not errorlevel 1 set "WRDONE=1"
)
)
if not defined WRDONE (
echo [FAIL] WinRAR - no version URL responded
set /a BAD+=1
)
echo ------------------------------------------------------------
echo.
echo Downloaded OK : %OK%
echo Failed : %BAD%
echo.
echo Files in %DEST%:
echo.
dir /b "%DEST%" 2>nul
echo.
echo ------------------------------------------------------------
echo INSTALL ORDER (run each as Administrator):
echo 1. WinRAR - plain Next / Next
echo 2. MariaDB .msi - set a root password, tick "UTF8 as default"
echo keep port 3306, install as a service
echo 3. HeidiSQL - connect to 127.0.0.1 : 3306 with that root password
echo ------------------------------------------------------------
echo.
choice /c YN /n /m " Open the folder now? [Y/N] "
if %errorlevel% equ 1 start "" explorer.exe "%DEST%"
exit /b 0
REM ============================================================
REM :Get <url> <output file> <label>
REM ============================================================
:Get
set "URL=%~1"
set "OUT=%~2"
set "LBL=%~3"
set "HAVE="
if exist "%OUT%" for %%F in ("%OUT%") do if %%~zF GTR 1000000 set "HAVE=1"
if defined HAVE (
echo [SKIP] %LBL% - already downloaded
set /a OK+=1
exit /b 0
)
echo.
echo [ .. ] %LBL%
if exist "%OUT%.part" del /q "%OUT%.part" >nul 2>&1
where curl.exe >nul 2>&1
if %errorlevel% equ 0 (
curl.exe -L --fail --retry 3 --retry-delay 3 --connect-timeout 25 --progress-bar -o "%OUT%.part" "%URL%"
) else (
powershell -NoProfile -ExecutionPolicy Bypass -Command "$ProgressPreference='SilentlyContinue'; [Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12; try { Invoke-WebRequest -Uri '%URL%' -OutFile '%OUT%.part' -UseBasicParsing } catch { exit 1 }"
)
if not exist "%OUT%.part" (
echo [FAIL] %LBL% - download failed
set /a BAD+=1
exit /b 1
)
for %%F in ("%OUT%.part") do if %%~zF LSS 100000 (
del /q "%OUT%.part" >nul 2>&1
echo [FAIL] %LBL% - file too small, link probably dead
set /a BAD+=1
exit /b 1
)
move /y "%OUT%.part" "%OUT%" >nul
echo [ OK ] %LBL%
set /a OK+=1
exit /b 0
REM ============================================================
REM :TryWinrar <version digits, e.g. 721>
REM ============================================================
:TryWinrar
set "WV=%~1"
set "WURL=https://www.win-rar.com/fileadmin/winrar-versions/winrar/winrar-x64-%WV%.exe"
where curl.exe >nul 2>&1
if %errorlevel% equ 0 (
curl.exe -sfIL --connect-timeout 15 "%WURL%" >nul 2>&1
if errorlevel 1 exit /b 1
)
call :Get "%WURL%" "%DEST%\winrar-x64-%WV%.exe" "WinRAR 64-bit (v%WV%)"
exit /b %errorlevel%