first commit
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
@echo off
|
||||
setlocal EnableDelayedExpansion
|
||||
title Trend Chart Launcher
|
||||
set "APP_DIR=%~dp0"
|
||||
set "APP_EXE=%APP_DIR%ChartAnalysis.exe"
|
||||
|
||||
if not exist "%APP_EXE%" (
|
||||
echo [ERROR] ChartAnalysis.exe not found in this folder.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Checking .NET Framework version...
|
||||
|
||||
set "RELHEX="
|
||||
for /f "tokens=3" %%v in ('reg query "HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" /v Release 2^>nul') do set "RELHEX=%%v"
|
||||
|
||||
if defined RELHEX (
|
||||
set /a RELDEC=RELHEX 2>nul
|
||||
if defined RELDEC (
|
||||
if !RELDEC! GEQ 394806 (
|
||||
echo [OK] .NET Framework 4.6.2+ detected. Starting program...
|
||||
start "" "%APP_EXE%"
|
||||
exit /b 0
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
echo.
|
||||
echo [INFO] .NET Framework 4.6.2 or higher is required.
|
||||
echo This launcher will download and install .NET Framework 4.8
|
||||
echo (supports Windows 7 SP1 to Windows 11), then start the program.
|
||||
echo.
|
||||
echo Downloading .NET Framework 4.8 (about 120MB)...
|
||||
set "DOTNET_URL=https://go.microsoft.com/fwlink/?linkid=2088631"
|
||||
set "INSTALLER=%TEMP%\dotnetfx48_setup.exe"
|
||||
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
|
||||
"$ErrorActionPreference='Stop'; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $wc = New-Object System.Net.WebClient; $wc.DownloadFile('%DOTNET_URL%','%INSTALLER%')"
|
||||
|
||||
if not exist "%INSTALLER%" (
|
||||
echo.
|
||||
echo [FAILED] Download failed. Please install manually:
|
||||
echo https://dotnet.microsoft.com/download/dotnet-framework/net48
|
||||
echo Then run Start.bat again.
|
||||
start "" "https://dotnet.microsoft.com/download/dotnet-framework/net48"
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Installing .NET Framework 4.8 silently, please wait...
|
||||
"%INSTALLER%" /q /norestart
|
||||
set "RC=%ERRORLEVEL%"
|
||||
|
||||
if %RC% NEQ 0 (
|
||||
echo.
|
||||
echo [WARN] Installer returned code %RC% (0 = success).
|
||||
if %RC% EQU 3010 (
|
||||
echo Reboot required. Please restart the computer, then run Start.bat again.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
echo Installation may have failed. Please retry after reboot.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo.
|
||||
echo [DONE] .NET Framework ready. Starting program...
|
||||
start "" "%APP_EXE%"
|
||||
exit /b 0
|
||||
Reference in New Issue
Block a user