Save sebagai .bat,
berikut:@echo off
setlocal EnableDelayedExpansion
title Instalasi Aplikasi Trading - HOTS & IPOT
:: =============================================================================
:: install_trading_apps.bat
:: Install otomatis: HOTS Mirae Asset & IPOT Indo Premier
:: Jalankan sebagai Administrator di Windows 10
:: =============================================================================
:: ─── Konfigurasi ─────────────────────────────────────────────────────────────
set HOTS_URL=https://cdn.miraeasset.co.id/hots/hots_setup.exe
set IPOT_URL=https://indopremier.com/xdir/product/ipotexe/ipot_installer.exe
set HOTS_FILE=%TEMP%\hots_setup.exe
set IPOT_FILE=%TEMP%\ipot_installer.exe
set LOG_FILE=%TEMP%\install_trading_apps.log
:: ─── Cek Administrator ───────────────────────────────────────────────────────
net session >nul 2>&1
if %errorlevel% neq 0 (
echo [ERROR] Script harus dijalankan sebagai Administrator!
echo.
echo Klik kanan file .bat ini, lalu pilih "Run as administrator"
pause
exit /b 1
)
:: ─── Header ──────────────────────────────────────────────────────────────────
cls
echo ============================================================
echo Instalasi Otomatis Aplikasi Trading
echo - HOTS Mirae Asset
echo - IPOT Indo Premier
echo ============================================================
echo.
call :LOG "Script dimulai. Log: %LOG_FILE%"
echo.
:: ─── Cek koneksi internet ────────────────────────────────────────────────────
call :LOG "Memeriksa koneksi internet..."
ping -n 1 google.com >nul 2>&1
if %errorlevel% neq 0 (
call :LOG_ERROR "Tidak ada koneksi internet. Periksa jaringan dan coba lagi."
pause
exit /b 1
)
call :LOG_OK "Koneksi internet OK"
:: =============================================================================
:: 1. HOTS MIRAE ASSET
:: =============================================================================
echo.
echo ----------------------------------------------------------
echo [1/2] HOTS Mirae Asset
echo ----------------------------------------------------------
call :LOG "Mengunduh HOTS Mirae Asset..."
call :LOG "URL : %HOTS_URL%"
call :LOG "Tujuan : %HOTS_FILE%"
curl -L --progress-bar --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" ^
-o "%HOTS_FILE%" "%HOTS_URL%"
if %errorlevel% neq 0 (
call :LOG_ERROR "Gagal mengunduh HOTS Mirae Asset. Lanjut ke instalasi berikutnya..."
goto INSTALL_IPOT
)
call :LOG_OK "HOTS Mirae Asset berhasil diunduh"
call :LOG "Menginstal HOTS Mirae Asset..."
start /wait "" "%HOTS_FILE%" /S /v/qn
if %errorlevel% equ 0 (
call :LOG_OK "HOTS Mirae Asset berhasil diinstal"
) else (
call :LOG_WARN "HOTS installer selesai dengan kode: %errorlevel%"
)
if exist "%HOTS_FILE%" del /f /q "%HOTS_FILE%"
call :LOG "File sementara HOTS dihapus"
:: =============================================================================
:: 2. IPOT INDO PREMIER
:: =============================================================================
:INSTALL_IPOT
echo.
echo ----------------------------------------------------------
echo [2/2] IPOT Indo Premier
echo ----------------------------------------------------------
call :LOG "Mengunduh IPOT Indo Premier..."
call :LOG "URL : %IPOT_URL%"
call :LOG "Tujuan : %IPOT_FILE%"
curl -L --progress-bar --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" ^
-o "%IPOT_FILE%" "%IPOT_URL%"
if %errorlevel% neq 0 (
call :LOG_ERROR "Gagal mengunduh IPOT Indo Premier."
goto FINISH
)
call :LOG_OK "IPOT Indo Premier berhasil diunduh"
call :LOG "Menginstal IPOT Indo Premier..."
start /wait "" "%IPOT_FILE%" /S /v/qn
if %errorlevel% equ 0 (
call :LOG_OK "IPOT Indo Premier berhasil diinstal"
) else (
call :LOG_WARN "IPOT installer selesai dengan kode: %errorlevel%"
)
if exist "%IPOT_FILE%" del /f /q "%IPOT_FILE%"
call :LOG "File sementara IPOT dihapus"
:: =============================================================================
:: Selesai
:: =============================================================================
:FINISH
echo.
echo ============================================================
echo Proses instalasi selesai!
echo Log lengkap: %LOG_FILE%
echo ============================================================
echo.
call :LOG_OK "Script selesai dijalankan."
pause
exit /b 0
:: =============================================================================
:: Fungsi LOG
:: =============================================================================
:LOG
set MSG=%~1
set TS=%DATE% %TIME%
echo [%TS%] [INFO] %MSG%
echo [%TS%] [INFO] %MSG% >> "%LOG_FILE%"
exit /b 0
:LOG_OK
set MSG=%~1
set TS=%DATE% %TIME%
echo [%TS%] [OK] %MSG%
echo [%TS%] [OK] %MSG% >> "%LOG_FILE%"
exit /b 0
:LOG_WARN
set MSG=%~1
set TS=%DATE% %TIME%
echo [%TS%] [WARN] %MSG%
echo [%TS%] [WARN] %MSG% >> "%LOG_FILE%"
exit /b 0
:LOG_ERROR
set MSG=%~1
set TS=%DATE% %TIME%
echo [%TS%] [ERROR] %MSG%
echo [%TS%] [ERROR] %MSG% >> "%LOG_FILE%"
exit /b 0
Selesai bro
No comments:
Post a Comment