@echo off
title Download Node.js Portable
cd /d "%~dp0"

echo.
echo ========================================
echo   Node.js Portable Downloader
echo ========================================
echo.

:: Check if already downloaded
if exist "nodejs-portable\node.exe" (
    echo Node.js portable is already installed!
    echo Location: %~dp0nodejs-portable\
    echo.
    for /f "delims=" %%i in ('"%~dp0nodejs-portable\node.exe" --version') do set NODE_VERSION=%%i
    echo Version: %NODE_VERSION%
    echo.
    echo You can now use START_PORTABLE.bat to launch the app!
    pause
    exit /b 0
)

echo This script will download Node.js LTS portable for Windows
echo.
echo What you need:
echo   - Internet connection
echo   - ~50 MB of free space
echo   - A few minutes
echo.
echo Press any key to continue or Ctrl+C to cancel...
pause >nul

echo.
echo ========================================
echo   Downloading Node.js...
echo ========================================
echo.
echo Opening download page in your browser...
echo.
echo INSTRUCTIONS:
echo 1. Download "Windows Binary (.zip)" - LTS version
echo 2. Extract the ZIP file
echo 3. Rename the extracted folder to "nodejs-portable"
echo 4. Move "nodejs-portable" into this folder:
echo    %~dp0
echo.
echo Once done, run START_PORTABLE.bat to launch!
echo.

:: Open the official Node.js download page
start https://nodejs.org/en/download/prebuilt-binaries

echo.
echo Download page opened in your browser!
echo Follow the instructions above.
echo.
pause
