:: =======================================================
:: ½ÃÀÛ
:: =======================================================
mode con: cols=120 lines=27
@echo off
chcp 949 > nul
title Program installer - jins.kr
color 0f

:: °ü¸®ÀÚ ±ÇÇÑ Ã¼Å©
net session >nul 2>&1
if %errorlevel% neq 0 (
    echo °ü¸®ÀÚ ±ÇÇÑÀ¸·Î ½ÇÇàÇÕ´Ï´Ù...
    powershell -Command "Start-Process '%~f0' -Verb RunAs"
    exit /b
)

setlocal EnableDelayedExpansion
set "40bar=¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬"
set "50bar=¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬"
set "120bar=¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬"

:: =======================================================
:: ±âº» ÇÁ·Î±×·¥ ¼³Ä¡ È®ÀÎ(winget, Chocolatey)
:: =======================================================
curl --version >nul 2>&1
if errorlevel 1 (
echo ÀÌ PC¿¡´Â curlÀÌ ¾ø½À´Ï´Ù.
echo curlÀÌ ¾øÀ¸¸é ÇÁ·Î±×·¥ÀÌ Á¤»óÀûÀ¸·Î ÀÛµ¿ÇÏÁö ¾Ê½À´Ï´Ù.
pause
)

winget --version >nul 2>&1
if errorlevel 1 (
  echo wingetÀÌ ¼³Ä¡µÇÁö ¾Ê¾Ò½À´Ï´Ù.
  choice /c YN /m "¼³Ä¡ÇÏ½Ã°Ú½À´Ï±î?"
  if errorlevel 2 (
    echo ¼³Ä¡ Ãë¼ÒµÊ.
    timeout /t 1 /nobreak >nul
    goto mainreset
  ) else (
    echo VCLibs Á¦°Å....
    powershell -command "Get-AppxProvisionedPackage -Online | Where-Object {$_.DisplayName -like "*VCLibs*"} | Remove-AppxProvisionedPackage -Online"
    powershell -command "Get-AppxPackage Microsoft.VCLibs.* -AllUsers | Remove-AppxPackage -AllUsers"
    echo !120bar!
    echo [100m[1mVCLibs ÃÖ½Å ¹öÀü ¼³Ä¡ Áß...[0m[1m
    curl -L https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -o VCLibs.appx
    powershell -command "Add-AppxPackage -ForceApplicationShutdown -ForceUpdateFromAnyVersion -Path VCLibs.appx"
    echo !120bar!
    echo [100m[1mUI.Xaml ÃÖ½Å ¹öÀü ¼³Ä¡ Áß...[0m[1m
    curl -L https://www.nuget.org/api/v2/package/Microsoft.UI.Xaml/2.8.6 -o uixaml.zip
    powershell -command "Expand-Archive uixaml.zip -DestinationPath uixaml -Force"
    powershell -command "Get-ChildItem .\uixaml -Recurse -Filter *.appx | Where-Object {$_.Name -like '*x64*'} | ForEach-Object {Add-AppxPackage -Path $_.FullName}"
    echo !120bar!
    echo [100m[1mWindows App Runtime ¼³Ä¡ Áß...[0m[1m
    curl -L https://aka.ms/windowsappsdk/1.8/latest/windowsappruntimeinstall-x64.exe -o windowsappruntimeinstall.exe
    windowsappruntimeinstall.exe /install
    curl -L https://aka.ms/getwinget -o Microsoft.DesktopAppInstaller.msixbundle
    powershell -command "Add-AppxPackage -Path Microsoft.DesktopAppInstaller.msixbundle"
    echo.
    echo [100m[1mProgram Installer Àç½ÃÀÛ[0m[1m
    echo winget ¼³Ä¡°¡ ¿Ï·áµÇ¾ú½À´Ï´Ù.
    echo Program installer ¸¦ ´Ù½Ã ½ÇÇàÇØ ÁÖ¼¼¿ä.
    pause
    explorer "%~dp0"
    taskkill /f /im cmd.exe
  )
) else (
  winget list --accept-source-agreements
)

choco --version >nul 2>&1
if errorlevel 1 (
  echo ChocolateyÀÌ ¼³Ä¡µÇÁö ¾Ê¾Ò½À´Ï´Ù.
  choice /c YN /m "¼³Ä¡ÇÏ½Ã°Ú½À´Ï±î?"
  if errorlevel 2 (
    echo ¼³Ä¡ Ãë¼ÒµÊ.
    timeout /t 1 /nobreak >nul
    goto mainreset
  ) else (
    echo !120bar!
    echo [100m[1mChocolatey ¼³Ä¡[0m[1m
    powershell -NoProfile -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))"
    echo.
    echo [100m[1mProgram Installer Àç½ÃÀÛ[0m[1m
    echo Chocolatey ¼³Ä¡°¡ ¿Ï·áµÇ¾ú½À´Ï´Ù.
    echo Program installer ¸¦ ´Ù½Ã ½ÇÇàÇØ ÁÖ¼¼¿ä.
    pause
    explorer "%~dp0"
    taskkill /f /im cmd.exe
  )
)

:: =======================================================
:: 1ÆäÀÌÁö(ÇÁ·Î±×·¥)
:: =======================================================
:mainreset
set p1=OFF
set p2=OFF
set p3=OFF
set p4=OFF
set p5=OFF
set p6=OFF
set p7=OFF
set p8=OFF
set p9=OFF
set p0=OFF
goto main

:main
mode con: cols=50 lines=31
color 0f
cls
if "!p1!"=="ON" (set 1mark=¡Ü) else (set 1mark=  )
if "!p2!"=="ON" (set 2mark=¡Ü) else (set 2mark=  )
if "!p3!"=="ON" (set 3mark=¡Ü) else (set 3mark=  )
if "!p4!"=="ON" (set 4mark=¡Ü) else (set 4mark=  )
if "!p5!"=="ON" (set 5mark=¡Ü) else (set 5mark=  )
if "!p6!"=="ON" (set 6mark=¡Ü) else (set 6mark=  )
if "!p7!"=="ON" (set 7mark=¡Ü) else (set 7mark=  )
if "!p8!"=="ON" (set 8mark=¡Ü) else (set 8mark=  )
if "!p9!"=="ON" (set 9mark=¡Ü) else (set 9mark=  )
if "!p0!"=="ON" (set 0mark=¡Ü) else (set 0mark=  )
echo.
echo !50bar!
echo              [104m[1m [ÇÁ·Î±×·¥ ¼³Ä¡ µµ¿ì¹Ì] [0m[1m
echo !50bar!
echo.
echo       1. [!1mark!] Whale ºê¶ó¿ìÀú
echo       2. [!2mark!] Ä«Ä«¿ÀÅå
echo       3. [!3mark!] ÆÌÇÃ·¹ÀÌ¾î
echo       4. [!4mark!] ¹ÝµðÁý
echo       5. [!5mark!] ¹Ýµðºä
echo       6. 
echo       7. 
echo       8. 
echo       9. 
echo       0. 
echo.
echo       S. ¼³Ä¡ ½ÃÀÛ
echo       A. ÀüÃ¼ ¼±ÅÃ       D. ÀüÃ¼ ÇØÁ¦
echo       F. ÇÑ±Û ´Ù¿î·Îµå   G. ¿ÀÇÇ½º ´Ù¿î·Îµå
echo       H. Adobe2021 ´Ù¿î·Îµå
echo.
echo      !40bar!
echo.
echo       [4mZ. 1page[0m[1m    X. 2page
echo       C. 3page    V. 4page(À©µµ¿ì¼³Á¤º¯°æ)
echo.
echo       Q. ³ª°¡±â
echo.
echo !50bar!
choice /c 1234567890SADFGHZXCVQ /n /m ": ¹øÈ£¸¦ ¼±ÅÃÇÏ¼¼¿ä : "
set sel=%errorlevel%

if %sel%==1 (
    if "!p1!"=="ON" (
        set p1=OFF
    ) else (
        set p1=ON
    )
    goto main
)
if %sel%==2 (
    if "!p2!"=="ON" (
        set p2=OFF
    ) else (
        set p2=ON
    )
    goto main
)
if %sel%==3 (
    if "!p3!"=="ON" (
        set p3=OFF
    ) else (
        set p3=ON
    )
    goto main
)
if %sel%==4 (
    if "!p4!"=="ON" (
        set p4=OFF
    ) else (
        set p4=ON
    )
    goto main
)
if %sel%==5 (
    if "!p5!"=="ON" (
        set p5=OFF
    ) else (
        set p5=ON
    )
    goto main
)
if %sel%==11 goto mainrun
if %sel%==12 (
     set p1=ON
     set p2=ON
     set p3=ON
     set p4=ON
     set p5=ON
     set p6=ON
     set p7=ON
     set p8=ON
     set p9=ON
     set p0=ON
goto main
)
if %sel%==13 (
    set p1=OFF
    set p2=OFF
    set p3=OFF
    set p4=OFF
    set p5=OFF
    set p6=OFF
    set p7=OFF
    set p8=OFF
    set p9=OFF
    set p0=OFF
goto main
)
if %sel%==14 goto hangul
if %sel%==15 goto office
if %sel%==16 adobe
if %sel%==17 goto mainreset
if %sel%==18 goto secpagereset
if %sel%==19 goto thdpagereset
if %sel%==20 goto fourthpagereset
if %sel%==21 goto exit
goto main

:: =======================================================
:: 2ÆäÀÌÁö(ÇÁ·Î±×·¥)
:: =======================================================
:secpagereset
set p1=OFF
set p2=OFF
set p3=OFF
set p4=OFF
set p5=OFF
set p6=OFF
set p7=OFF
set p8=OFF
set p9=OFF
set p0=OFF
goto secpage

:secpage
mode con: cols=50 lines=31
color 0f
cls
if "!p1!"=="ON" (set 1mark=¡Ü) else (set 1mark=  )
if "!p2!"=="ON" (set 2mark=¡Ü) else (set 2mark=  )
if "!p3!"=="ON" (set 3mark=¡Ü) else (set 3mark=  )
if "!p4!"=="ON" (set 4mark=¡Ü) else (set 4mark=  )
if "!p5!"=="ON" (set 5mark=¡Ü) else (set 5mark=  )
if "!p6!"=="ON" (set 6mark=¡Ü) else (set 6mark=  )
if "!p7!"=="ON" (set 7mark=¡Ü) else (set 7mark=  )
if "!p8!"=="ON" (set 8mark=¡Ü) else (set 8mark=  )
if "!p9!"=="ON" (set 9mark=¡Ü) else (set 9mark=  )
if "!p0!"=="ON" (set 0mark=¡Ü) else (set 0mark=  )
echo.
echo !50bar!
echo              [104m[1m [ÇÁ·Î±×·¥ ¼³Ä¡ µµ¿ì¹Ì] [0m[1m
echo !50bar!
echo.
echo       1. [!1mark!] Everything
echo       2. [!2mark!] AnyTXTSearcher
echo       3. [!3mark!] PDF Gear
echo       4. [!4mark!] Zoom
echo       5. [!5mark!] Discord
echo       6. [!6mark!] Filezilla
echo       7. [!7mark!] RaiDrive
echo       8. [!8mark!] OBSStudio
echo       9. 
echo       0. 
echo.
echo       S. ¼³Ä¡ ½ÃÀÛ
echo       A. ÀüÃ¼ ¼±ÅÃ     D. ÀüÃ¼ ÇØÁ¦
echo       F. ÇÁ·Î±×·¥ »èÁ¦
echo.
echo.
echo      !40bar!
echo.
echo       Z. 1page    [4mX. 2page[0m[1m
echo       C. 3page    V. 4page(À©µµ¿ì¼³Á¤º¯°æ)
echo.
echo       Q. ³ª°¡±â
echo.
echo !50bar!
choice /c 1234567890SADFZXCVQ /n /m ": ¹øÈ£¸¦ ¼±ÅÃÇÏ¼¼¿ä : "
set sel=%errorlevel%

if %sel%==1 (
    if "!p1!"=="ON" (
        set p1=OFF
    ) else (
        set p1=ON
    )
    goto secpage
)
if %sel%==2 (
    if "!p2!"=="ON" (
        set p2=OFF
    ) else (
        set p2=ON
    )
    goto secpage
)
if %sel%==3 (
    if "!p3!"=="ON" (
        set p3=OFF
    ) else (
        set p3=ON
    )
    goto secpage
)
if %sel%==4 (
    if "!p4!"=="ON" (
        set p4=OFF
    ) else (
        set p4=ON
    )
    goto secpage
)
if %sel%==5 (
    if "!p5!"=="ON" (
        set p5=OFF
    ) else (
        set p5=ON
    )
    goto secpage
)
if %sel%==6 (
    if "!p6!"=="ON" (
        set p6=OFF
    ) else (
        set p6=ON
    )
    goto secpage
)
if %sel%==7 (
    if "!p7!"=="ON" (
        set p7=OFF
    ) else (
        set p7=ON
    )
    goto secpage
)
if %sel%==8 (
    if "!p8!"=="ON" (
        set p8=OFF
    ) else (
        set p8=ON
    )
    goto secpage
)
if %sel%==11 goto secrun
if %sel%==12 (
     set p1=ON
     set p2=ON
     set p3=ON
     set p4=ON
     set p5=ON
     set p6=ON
     set p7=ON
     set p8=ON
     set p9=ON
     set p0=ON
goto secpage
)
if %sel%==13 (
    set p1=OFF
    set p2=OFF
    set p3=OFF
    set p4=OFF
    set p5=OFF
    set p6=OFF
    set p7=OFF
    set p8=OFF
    set p9=OFF
    set p0=OFF
goto secpage
)
if %sel%==14 goto geek
if %sel%==15 goto mainreset
if %sel%==16 goto secpagereset
if %sel%==17 goto thdpagereset
if %sel%==18 goto fourthpagereset
if %sel%==19 goto exit
goto secpage

:: =======================================================
:: 3ÆäÀÌÁö(ÇÁ·Î±×·¥)
:: =======================================================
:thdpagereset
set p1=OFF
set p2=OFF
set p3=OFF
set p4=OFF
set p5=OFF
set p6=OFF
set p7=OFF
set p8=OFF
set p9=OFF
set p0=OFF
goto thdpage

:thdpage
mode con: cols=50 lines=31
color 0f
cls
if "!p1!"=="ON" (set 1mark=¡Ü) else (set 1mark=  )
if "!p2!"=="ON" (set 2mark=¡Ü) else (set 2mark=  )
if "!p3!"=="ON" (set 3mark=¡Ü) else (set 3mark=  )
if "!p4!"=="ON" (set 4mark=¡Ü) else (set 4mark=  )
if "!p5!"=="ON" (set 5mark=¡Ü) else (set 5mark=  )
if "!p6!"=="ON" (set 6mark=¡Ü) else (set 6mark=  )
if "!p7!"=="ON" (set 7mark=¡Ü) else (set 7mark=  )
if "!p8!"=="ON" (set 8mark=¡Ü) else (set 8mark=  )
if "!p9!"=="ON" (set 9mark=¡Ü) else (set 9mark=  )
if "!p0!"=="ON" (set 0mark=¡Ü) else (set 0mark=  )
echo.
echo !50bar!
echo              [104m[1m [ÇÁ·Î±×·¥ ¼³Ä¡ µµ¿ì¹Ì] [0m[1m
echo !50bar!
echo.
echo       1. [!1mark!] CPU-Z(ÇÏµå¿þ¾î Á¤º¸)
echo       2. [!2mark!] HWMonitor(ÇÏµå¿þ¾î ¸ð´ÏÅÍ)
echo       3. [!3mark!] UniGetUI(ÇÁ·Î±×·¥ ÆÐÅ°Áö °ü¸®)
echo       4. [!4mark!] GlaryUtilities(PCÁ¤¸®)
echo       5. [!5mark!] HopToDesk(¿ø°ÝÁ¦¾î)
echo       6. [!6mark!] Parsec(¿ø°ÝÁ¦¾î)
echo       7. [!7mark!] LosslessCut(µ¿¿µ»ó¹«¼Õ½ÇÆíÁý)
echo       8. [!8mark!] yt-dlp(À¯Æ©ºê´Ù¿î·Î´õ)
echo       9. 
echo       0. 
echo.
echo       S. ¼³Ä¡ ½ÃÀÛ
echo       A. ÀüÃ¼ ¼±ÅÃ     D. ÀüÃ¼ ÇØÁ¦
echo       F. PCActivityLog
echo.
echo.
echo      !40bar!
echo.
echo       Z. 1page    X. 2page
echo       [4mC. 3page[0m[1m    V. 4page(À©µµ¿ì¼³Á¤º¯°æ)
echo.
echo       Q. ³ª°¡±â
echo.
echo !50bar!
choice /c 1234567890SADFZXCVQ /n /m ": ¹øÈ£¸¦ ¼±ÅÃÇÏ¼¼¿ä : "
set sel=%errorlevel%

if %sel%==1 (
    if "!p1!"=="ON" (
        set p1=OFF
    ) else (
        set p1=ON
    )
    goto thdpage
)
if %sel%==2 (
    if "!p2!"=="ON" (
        set p2=OFF
    ) else (
        set p2=ON
    )
    goto thdpage
)
if %sel%==3 (
    if "!p3!"=="ON" (
        set p3=OFF
    ) else (
        set p3=ON
    )
    goto thdpage
)
if %sel%==4 (
    if "!p4!"=="ON" (
        set p4=OFF
    ) else (
        set p4=ON
    )
    goto thdpage
)
if %sel%==5 (
    if "!p5!"=="ON" (
        set p5=OFF
    ) else (
        set p5=ON
    )
    goto thdpage
)
if %sel%==6 (
    if "!p6!"=="ON" (
        set p6=OFF
    ) else (
        set p6=ON
    )
    goto thdpage
)
if %sel%==7 (
    if "!p7!"=="ON" (
        set p7=OFF
    ) else (
        set p7=ON
    )
    goto thdpage
)
if %sel%==8 (
    if "!p8!"=="ON" (
        set p8=OFF
    ) else (
        set p8=ON
    )
    goto thdpage
)
if %sel%==11 goto thdrun
if %sel%==12 (
     set p1=ON
     set p2=ON
     set p3=ON
     set p4=ON
     set p5=ON
     set p6=ON
     set p7=ON
     set p8=ON
     set p9=ON
     set p0=ON
goto thdpage
)
if %sel%==13 (
    set p1=OFF
    set p2=OFF
    set p3=OFF
    set p4=OFF
    set p5=OFF
    set p6=OFF
    set p7=OFF
    set p8=OFF
    set p9=OFF
    set p0=OFF
goto thdpage
)
if %sel%==14 goto PCActivityLog
if %sel%==15 goto mainreset
if %sel%==16 goto secpagereset
if %sel%==17 goto thdpagereset
if %sel%==18 goto fourthpagereset
if %sel%==19 goto exit
goto thdpage

:: =======================================================
:: 4ÆäÀÌÁö(Windows¼³Á¤º¯°æ)
:: =======================================================
:fourthpagereset
set p1=OFF
set p2=OFF
set p3=OFF
set p4=OFF
set p5=OFF
set p6=OFF
set p7=OFF
set p8=OFF
set p9=OFF
set p0=OFF
goto fourthpage

:fourthpage
mode con: cols=50 lines=31
color 0f
cls
if "!p1!"=="ON" (set 1mark=¡Ü) else (set 1mark=  )
if "!p2!"=="ON" (set 2mark=¡Ü) else (set 2mark=  )
if "!p3!"=="ON" (set 3mark=¡Ü) else (set 3mark=  )
if "!p4!"=="ON" (set 4mark=¡Ü) else (set 4mark=  )
if "!p5!"=="ON" (set 5mark=¡Ü) else (set 5mark=  )
if "!p6!"=="ON" (set 6mark=¡Ü) else (set 6mark=  )
if "!p7!"=="ON" (set 7mark=¡Ü) else (set 7mark=  )
if "!p8!"=="ON" (set 8mark=¡Ü) else (set 8mark=  )
if "!p9!"=="ON" (set 9mark=¡Ü) else (set 9mark=  )
if "!p0!"=="ON" (set 0mark=¡Ü) else (set 0mark=  )
echo.
echo !50bar!
echo               [105m[1m [Windows ¼³Á¤º¯°æ] [0m[1m
echo !50bar!
echo.
echo       1. [!1mark!] ÃÖ´ë ÀýÀü ¸ðµå ²ô±â
echo       2. [!2mark!] Àü¿ø ¿É¼Ç °í¼º´É º¯°æ
echo       3. [!3mark!] ³» PC ¾ÆÀÌÄÜ Ç¥½Ã
echo       4. [!4mark!] ¾ÆÀÌÄÜ ÀÚµ¿Á¤·Ä
echo       5. [!5mark!] ÀÛ¾÷Ç¥½ÃÁÙ ÇÕÄ¡±â ¼³Á¤ ÇØÁ¦
echo       6. [!6mark!] ÆÄÀÏ È®ÀåÀÚ¸í Ç¥½Ã
echo       7. 
echo       8. 
echo       9. 
echo       0. 
echo.
echo       S. ½ÇÇà
echo       A. ÀüÃ¼ ¼±ÅÃ     D. ÀüÃ¼ ÇØÁ¦
echo       F. Defender¼³Á¤  G. À©µµ¿ì ¾÷µ¥ÀÌÆ® ²ô±â
echo       E. Windows MSoffice ÀÎÁõ     R. WPD
echo.
echo      !40bar!
echo.
echo       Z. 1page    X. 2page
echo       C. 3page    [4mV. 4page(À©µµ¿ì¼³Á¤º¯°æ)[0m[1m
echo.
echo       Q. ³ª°¡±â
echo.
echo !50bar!
choice /c 1234567890SADFGERZXCVQ /n /m ": ¹øÈ£¸¦ ¼±ÅÃÇÏ¼¼¿ä : "
set sel=%errorlevel%

if %sel%==1 (
    if "!p1!"=="ON" (
        set p1=OFF
    ) else (
        set p1=ON
    )
    goto fourthpage
)
if %sel%==2 (
    if "!p2!"=="ON" (
        set p2=OFF
    ) else (
        set p2=ON
    )
    goto fourthpage
)
if %sel%==3 (
    if "!p3!"=="ON" (
        set p3=OFF
    ) else (
        set p3=ON
    )
    goto fourthpage
)
if %sel%==4 (
    if "!p4!"=="ON" (
        set p4=OFF
    ) else (
        set p4=ON
    )
    goto fourthpage
)
if %sel%==5 (
    if "!p5!"=="ON" (
        set p5=OFF
    ) else (
        set p5=ON
    )
    goto fourthpage
)
if %sel%==6 (
    if "!p6!"=="ON" (
        set p6=OFF
    ) else (
        set p6=ON
    )
    goto fourthpage
)
if %sel%==11 goto fourthrun
if %sel%==12 (
     set p1=ON
     set p2=ON
     set p3=ON
     set p4=ON
     set p5=ON
     set p6=ON
     set p7=ON
     set p8=ON
     set p9=ON
     set p0=ON
goto fourthpage
)
if %sel%==13 (
    set p1=OFF
    set p2=OFF
    set p3=OFF
    set p4=OFF
    set p5=OFF
    set p6=OFF
    set p7=OFF
    set p8=OFF
    set p9=OFF
    set p0=OFF
goto fourthpage
)
if %sel%==14 goto defender
if %sel%==15 goto winupdateoff
if %sel%==16 goto activated
if %sel%==17 goto wpd
if %sel%==18 goto mainreset
if %sel%==19 goto secpagereset
if %sel%==20 goto thdpagereset
if %sel%==21 goto fourthpagereset
if %sel%==22 goto exit
goto fourthpage

:: =======================================================
:: ½ÇÇà!
:: =======================================================
:mainrun
mode con: cols=120 lines=27
cls
echo !120bar!
echo [101m[1m¼±ÅÃµÈ ÇÁ·Î±×·¥ ¼³Ä¡ Áß...[0m[1m
echo !120bar!

if "%p1%"=="ON" (
    echo [100m[1mWhale ´Ù¿î·Îµå ¹× ¼³Ä¡[0m[1m
    set "DL_URL=https://installer-whale.pstatic.net/downloads/installers/WhaleSetup.exe"
    set "DL_FILE=WhaleSetup.exe"
    set "DL_DEST=%TEMP%\!DL_FILE!"
    call :download_file "!DL_URL!" "!DL_FILE!" "!DL_DEST!"
    echo [100m[1mWhale ¼³Ä¡ ½ÃÀÛ...[0m[1m
    start /wait "" "!DL_DEST!" /S
)
if "%p2%"=="ON" (
    set "Pg_Name=Ä«Ä«¿ÀÅå"
    set "Winget_Pg_Name=Kakao.KakaoTalk"
    set "Choco_Pg_Name=kakaotalk"
    set "Silent_Mode=off"
    call :instpg "!Pg_Name!" "!Winget_Pg_Name!" "!Choco_Pg_Name!" "!Silent_Mode!"
)
if "%p3%"=="ON" (
    set "Pg_Name=ÆÌÇÃ·¹ÀÌ¾î"
    set "Winget_Pg_Name=Daum.PotPlayer"
    set "Choco_Pg_Name=potplayer"
    set "Silent_Mode=on"
    call :instpg "!Pg_Name!" "!Winget_Pg_Name!" "!Choco_Pg_Name!" "!Silent_Mode!"
)
if "%p4%"=="ON" (
    set "Pg_Name=¹ÝµðÁý"
    set "Winget_Pg_Name=Bandisoft.Bandizip"
    set "Choco_Pg_Name=bandizip"
    set "Silent_Mode=on"
    call :instpg "!Pg_Name!" "!Winget_Pg_Name!" "!Choco_Pg_Name!" "!Silent_Mode!"
)
if "%p5%"=="ON" (
    set "Pg_Name=¹Ýµðºä"
    set "Winget_Pg_Name=Bandisoft.BandiView"
    set "Choco_Pg_Name=BandiView"
    set "Silent_Mode=on"
    call :instpg "!Pg_Name!" "!Winget_Pg_Name!" "!Choco_Pg_Name!" "!Silent_Mode!"
)
echo.
echo !120bar!
echo [101m[1mÇÁ·Î±×·¥ ¼³Ä¡°¡ ¿Ï·áµÇ¾ú½À´Ï´Ù.[0m[1m
timeout /t 3 /nobreak >nul
goto mainreset

:: =======================================================
:secrun
mode con: cols=120 lines=27
cls
echo !120bar!
echo [101m[1m¼±ÅÃµÈ ÇÁ·Î±×·¥ ¼³Ä¡ Áß...[0m[1m
echo !120bar!

if "%p1%"=="ON" (
    set "Pg_Name=Everything"
    set "Winget_Pg_Name=voidtools.Everything"
    set "Choco_Pg_Name=Everything"
    set "Silent_Mode=on"
    call :instpg "!Pg_Name!" "!Winget_Pg_Name!" "!Choco_Pg_Name!" "!Silent_Mode!"
)
if "%p2%"=="ON" (
    set "Pg_Name=AnyTXTSearcher"
    set "Winget_Pg_Name=AnyTXT.AnyTXTSearcher"
    set "Choco_Pg_Name=AnyTXTSearcher"
    set "Silent_Mode=on"
    call :instpg "!Pg_Name!" "!Winget_Pg_Name!" "!Choco_Pg_Name!" "!Silent_Mode!"
)
if "%p3%"=="ON" (
    set "Pg_Name=PDF Gear"
    set "Winget_Pg_Name=PDFgear.PDFgear"
    set "Choco_Pg_Name=pdfgear"
    set "Silent_Mode=on"
    call :instpg "!Pg_Name!" "!Winget_Pg_Name!" "!Choco_Pg_Name!" "!Silent_Mode!"
)
if "%p4%"=="ON" (
    set "Pg_Name=Zoom"
    set "Winget_Pg_Name=Zoom.Zoom"
    set "Choco_Pg_Name=zoom"
    set "Silent_Mode=on"
    call :instpg "!Pg_Name!" "!Winget_Pg_Name!" "!Choco_Pg_Name!" "!Silent_Mode!"
)
if "%p5%"=="ON" (
    set "Pg_Name=Discord"
    set "Winget_Pg_Name=Discord.Discord"
    set "Choco_Pg_Name=discord"
    set "Silent_Mode=on"
    call :instpg "!Pg_Name!" "!Winget_Pg_Name!" "!Choco_Pg_Name!" "!Silent_Mode!"
)
if "%p6%"=="ON" (
    echo [100m[1mFileZilla ´Ù¿î·Îµå[0m[1m
    set "DL_URL=https://jins.kr/app/FileZilla_setup.exe"
    set "DL_FILE=FileZilla_setup.exe"
    set "DL_DEST=%TEMP%\!DL_FILE!"
    call :download_file "!DL_URL!" "!DL_FILE!" "!DL_DEST!"
    echo.
    echo [100m[1mFilezilla ¼³Ä¡[0m[1m
    start /wait "" "!DL_DEST!" /S
    powershell -Command "$s=(New-Object -ComObject WScript.Shell).CreateShortcut('%USERPROFILE%\Desktop\FileZilla.lnk');$s.TargetPath='%ProgramFiles%\FileZilla FTP Client\filezilla.exe';$s.Save()"
)
if "%p7%"=="ON" (
    set "Pg_Name=RaiDrive"
    set "Winget_Pg_Name=OpenBoxLab.RaiDrive"
    set "Choco_Pg_Name=raidrive"
    set "Silent_Mode=on"
    call :instpg "!Pg_Name!" "!Winget_Pg_Name!" "!Choco_Pg_Name!" "!Silent_Mode!"
)
if "%p8%"=="ON" (
    set "Pg_Name=OBSStudio"
    set "Winget_Pg_Name=OBSProject.OBSStudio"
    set "Choco_Pg_Name=obs-studio"
    set "Silent_Mode=on"
    call :instpg "!Pg_Name!" "!Winget_Pg_Name!" "!Choco_Pg_Name!" "!Silent_Mode!"
)
echo.
echo !120bar!
echo [101m[1mÇÁ·Î±×·¥ ¼³Ä¡°¡ ¿Ï·áµÇ¾ú½À´Ï´Ù.[0m[1m
timeout /t 3 /nobreak >nul
goto secpagereset

:: =======================================================
:thdrun
mode con: cols=120 lines=27
cls
echo !120bar!
echo [101m[1m¼±ÅÃµÈ ÇÁ·Î±×·¥ ¼³Ä¡ Áß...[0m[1m
echo !120bar!

if "%p1%"=="ON" (
    set "Pg_Name=CPU-Z"
    set "Winget_Pg_Name=CPUID.CPU-Z"
    set "Choco_Pg_Name=cpu-z"
    set "Silent_Mode=on"
    call :instpg "!Pg_Name!" "!Winget_Pg_Name!" "!Choco_Pg_Name!" "!Silent_Mode!"
)
if "%p2%"=="ON" (
    set "Pg_Name=HWMonitor"
    set "Winget_Pg_Name=CPUID.HWMonitor"
    set "Choco_Pg_Name=hwmonitor"
    set "Silent_Mode=on"
    call :instpg "!Pg_Name!" "!Winget_Pg_Name!" "!Choco_Pg_Name!" "!Silent_Mode!"
)
if "%p3%"=="ON" (
    set "Pg_Name=UniGetUI"
    set "Winget_Pg_Name=Devolutions.UniGetUI"
    set "Choco_Pg_Name=UniGetUI"
    set "Silent_Mode=on"
    call :instpg "!Pg_Name!" "!Winget_Pg_Name!" "!Choco_Pg_Name!" "!Silent_Mode!"
)
if "%p4%"=="ON" (
    set "Pg_Name=GlaryUtilities"
    set "Winget_Pg_Name=Glarysoft.GlaryUtilities"
    set "Choco_Pg_Name=glaryutilities"
    set "Silent_Mode=off"
    call :instpg "!Pg_Name!" "!Winget_Pg_Name!" "!Choco_Pg_Name!" "!Silent_Mode!"
)
if "%p5%"=="ON" (
    echo [100m[1mHopToDesk ´Ù¿î·Îµå[0m[1m
    set "DL_URL=https://download.hoptodesk.com/HopToDesk.exe"
    set "DL_FILE=HopToDesk.exe"
    set "DL_DEST=%TEMP%\!DL_FILE!"
    call :download_file "!DL_URL!" "!DL_FILE!" "!DL_DEST!"
    echo.
    echo [100m[1mHopToDesk ¼³Ä¡[0m[1m
    start /wait "" "!DL_DEST!" --silent-install
)
if "%p6%"=="ON" (
    set "Pg_Name=Parsec"
    set "Winget_Pg_Name=Parsec.Parsec"
    set "Choco_Pg_Name=parsec"
    set "Silent_Mode=on"
    call :instpg "!Pg_Name!" "!Winget_Pg_Name!" "!Choco_Pg_Name!" "!Silent_Mode!"
)
if "%p7%"=="ON" (
    echo [100m[1mLosslessCut ´Ù¿î·Îµå[0m[1m
    set "DL_URL=https://github.com/mifi/lossless-cut/releases/latest/download/LosslessCut-win-x64.7z"
    set "DL_FILE=LosslessCut-win-x64.7z"
    set "DL_DEST=%TEMP%\!DL_FILE!"
    call :download_file "!DL_URL!" "!DL_FILE!" "!DL_DEST!"
    echo.
    echo [100m[1mLosslessCut ¼³Ä¡[0m[1m
    echo make folder
    mkdir "%ProgramFiles%\LosslessCut"
    timeout /t 2 /nobreak >nul
    echo unzip file
    tar -xvf "!DL_DEST!" -C "%ProgramFiles%\LosslessCut"
    echo lnk file copy
    powershell -Command "$s=(New-Object -ComObject WScript.Shell).CreateShortcut('%USERPROFILE%\Desktop\LosslessCut.lnk');$s.TargetPath='%ProgramFiles%\LosslessCut\LosslessCut.exe';$s.Save()"
)
if "%p8%"=="ON" (
    set "Pg_Name=yt-dlp"
    set "Winget_Pg_Name=yt-dlp.yt-dlp"
    set "Choco_Pg_Name=yt-dlp"
    call :instpg "!Pg_Name!" "!Winget_Pg_Name!" "!Choco_Pg_Name!"
    set "DL_URL=https://jins.kr/app/Youtube_Video_Downloader(yt-dlp).bat"
    set "DL_FILE=Youtube_Video_Downloader(yt-dlp).bat"
    set "DL_DEST=%USERPROFILE%\Desktop\À¯Æ©ºê_ºñµð¿À_´Ù¿î·Îµå.bat"
    call :download_file "!DL_URL!" "!DL_FILE!" "!DL_DEST!"
    set "DL_URL=https://jins.kr/app/Youtube_Audio_Downloader(yt-dlp).bat"
    set "DL_FILE=Youtube_Video_Downloader(yt-dlp).bat"
    set "DL_DEST=%USERPROFILE%\Desktop\À¯Æ©ºê_¿Àµð¿À_´Ù¿î·Îµå.bat"
    call :download_file "!DL_URL!" "!DL_FILE!" "!DL_DEST!"
)
echo.
echo !120bar!
echo [101m[1mÇÁ·Î±×·¥ ¼³Ä¡°¡ ¿Ï·áµÇ¾ú½À´Ï´Ù.[0m[1m
timeout /t 3 /nobreak >nul
goto thdpagereset

:: =======================================================
:fourthrun
mode con: cols=120 lines=27
cls
echo !120bar!
echo [101m[1m¼±ÅÃµÈ ¼³Á¤ º¯°æ Áß...[0m[1m
echo !120bar!
if "%p1%"=="ON" (
echo [100m[1mÃÖ´ëÀýÀü¸ðµå ²ô±â[0m[1m
echo powercfg -h off
powercfg -h off
)
if "%p2%"=="ON" (
echo [100m[1mÀü¿ø¿É¼Ç °í¼º´É º¯°æ[0m[1m
echo POWERCFG -SETACTIVE 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
POWERCFG -SETACTIVE 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
echo POWERCFG /Change /standby-timeout-ac 0
POWERCFG /Change /standby-timeout-ac 0
echo POWERCFG /Change /disk-timeout-ac 0
POWERCFG /Change /disk-timeout-ac 0
echo POWERCFG /Change /monitor-timeout-ac 0
POWERCFG /Change /monitor-timeout-ac 0
)
if "%p3%"=="ON" (
echo [100m[1m³» PC ¾ÆÀÌÄÜ Ç¥½Ã[0m[1m
echo reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /v {20D04FE0-3AEA-1069-A2D8-08002B30309D} /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /v {20D04FE0-3AEA-1069-A2D8-08002B30309D} /t REG_DWORD /d 0 /f
set "need_restart=ON"
)
if "%p4%"=="ON" (
echo [100m[1m¾ÆÀÌÄÜ ÀÚµ¿Á¤·Ä[0m[1m
echo reg add "HKCU\Software\Microsoft\Windows\Shell\Bags\1\Desktop" /v FFlags /t REG_DWORD /d 1075839525 /f
reg add "HKCU\Software\Microsoft\Windows\Shell\Bags\1\Desktop" /v FFlags /t REG_DWORD /d 1075839525 /f
set "need_restart=ON"
)
if "%p5%"=="ON" (
echo [100m[1mÀÛ¾÷Ç¥½ÃÁÙ ÇÕÄ¡±â ¼³Á¤ ÇØÁ¦[0m[1m
echo reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v TaskbarGlomLevel /t REG_DWORD /d 2 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v TaskbarGlomLevel /t REG_DWORD /d 2 /f
set "need_restart=ON"
)
if "%p6%"=="ON" (
echo [100m[1mÆÄÀÏ È®ÀåÀÚ¸í Ç¥½Ã[0m[1m
echo reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v HideFileExt /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v HideFileExt /t REG_DWORD /d 0 /f
set "need_restart=ON"
)
if "%need_restart%"=="ON" (
	echo explorer Àç½ÃÀÛ
	echo taskkill /f /im explorer.exe
	taskkill /f /im explorer.exe
	echo start explorer.exe
	start explorer.exe
)
echo.
echo !120bar!
echo [101m[1m¼³Á¤ º¯°æ µÇ¾ú½À´Ï´Ù.[0m[1m
timeout /t 3 /nobreak >nul
goto fourthpagereset

:: =======================================================
:hangul
mode con: cols=120 lines=27
cls
echo !120bar!
echo [100m[1mÇÑ±Û ´Ù¿î·Îµå[0m[1m
curl -L -o %TEMP%\HNCDown.bat https://jins.kr/app/HNCDown.bat
start "" "%TEMP%\HNCDown.bat"
timeout /t 1 /nobreak >nul
goto mainreset

:: =======================================================
:office
mode con: cols=120 lines=27
cls
echo !120bar!
echo [100m[1mMS Office ´Ù¿î·Îµå[0m[1m
curl -L -o %TEMP%\MSOfficeDown.bat https://jins.kr/app/MSOfficeDown.bat
start "" "%TEMP%\MSOfficeDown.bat"
timeout /t 1 /nobreak >nul
goto mainreset

:: =======================================================
:adobe
mode con: cols=120 lines=27
cls
echo !120bar!
echo [100m[1mAdobe2021 ´Ù¿î·Îµå[0m[1m
curl -L -o %TEMP%\Adobe2021Down.bat https://jins.kr/app/Adobe2021Down.bat
start "" "%TEMP%\Adobe2021Down.bat"
timeout /t 1 /nobreak >nul
goto mainreset

:: =======================================================
:geek
mode con: cols=120 lines=27
cls
echo !120bar!
echo [100m[1mgeek ´Ù¿î·Îµå[0m[1m
set "DL_URL=https://geekuninstaller.com/geek.zip"
set "DL_FILE=geek.zip"
set "DL_DEST=%TEMP%\!DL_FILE!"
call :download_file "!DL_URL!" "!DL_FILE!" "!DL_DEST!"
echo.
echo [100m[1mgeek ¾ÐÃàÇØÁ¦[0m[1m
tar -xvf "!DL_DEST!" -C "%TEMP%"
timeout /t 1 /nobreak >nul
move "%TEMP%\geek.exe" "%USERPROFILE%\Desktop\"
timeout /t 2 /nobreak >nul
echo.
echo [100m[1mgeek ½ÇÇà[0m[1m
start "" "%USERPROFILE%\Desktop\geek.exe"
timeout /t 3 /nobreak >nul
goto secpagereset

:: =======================================================
:PCActivityLog
mode con: cols=120 lines=27
cls
echo !120bar!
echo [100m[1mPCActivityLog ´Ù¿î·Îµå[0m[1m
set "DL_URL=https://jins.kr/app/PCActivityLog.zip"
set "DL_FILE=PCActivityLog.zip"
set "DL_DEST=%TEMP%\!DL_FILE!"
call :download_file "!DL_URL!" "!DL_FILE!" "!DL_DEST!"
echo.
echo [100m[1mPCActivityLog ¾ÐÃàÇØÁ¦[0m[1m
tar -xvf "!DL_DEST!" -C "%TEMP%"
timeout /t 1 /nobreak >nul
echo [100m[1mPCActivityLog ¼³Ä¡[0m[1m
mkdir "%SystemDrive%\PCActivityLog\"
move "%TEMP%\PCActivityLog.exe" "%SystemDrive%\PCActivityLog\"
move "%TEMP%\PCActivityLog_kill.bat" "%SystemDrive%\PCActivityLog\"
echo.
choice /c YN /m "½ÃÀÛ ÇÁ·Î±×·¥¿¡ µî·ÏÇÏ½Ã°Ú½À´Ï±î?"
if %errorlevel%==1 (
   echo [100m[1mPCActivityLog ½ÃÀÛ ÇÁ·Î±×·¥ µî·Ï[0m[1m
   powershell "$s=(New-Object -COM WScript.Shell).CreateShortcut('%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\PCActivityLog.lnk');$s.TargetPath='%SystemDrive%\PCActivityLog\PCActivityLog.exe';$s.Save()"
)
echo.
echo ·Î±×ÆÄÀÏÀ» ¼­¹ö¿¡ Àü¼ÛÇÏ±â À§ÇÑ ½ºÅ©¸³Æ®¸¦ »ý¼ºÇÕ´Ï´Ù.
choice /c YN /m "½ºÅ©¸³Æ®¸¦ »ý¼º ÇÏ½Ã°Ú½À´Ï±î?"
if %errorlevel%==2 (
goto mainreset
)
if %errorlevel%==1 (
:upload_input
echo ¾÷·Îµå ½ºÅ©¸³Æ®¸¦ »ý¼ºÇÕ´Ï´Ù.
echo.
echo ¾÷·Îµå ¼­¹ö ¿¬°á ¹æ½ÄÀ» ¼±ÅÃÇÏ¼¼¿ä:
echo  1. FTP      (±âº» ÆÄÀÏ Àü¼Û, ÀÏ¹ÝÀûÀÎ °æ¿ì)
echo  2. SCP      (SSH ±â¹Ý º¸¾È Àü¼Û, º¸¾ÈÀÌ ÇÊ¿äÇÑ °æ¿ì)
echo  3. WebDAV   (À¥ ±â¹Ý ÆÄÀÏ °øÀ¯ µð·ºÅÍ¸®)
set /p CONN_TYPE="¼±ÅÃ (1~3): "
echo.
set /p SERVER_IP="¼­¹ö ÁÖ¼Ò (IP ¶Ç´Â µµ¸ÞÀÎ): "
echo.
set /p PORT_NUM="Æ÷Æ® ¹øÈ£ (°ø¶õÀÏ °æ¿ì ±âº»Æ÷Æ® »ç¿ë): "
echo.
set /p USER_ID="ID: "
echo.
set /p USER_PW="PW: "
echo.
set /p REMOTE_DIR="¾÷·Îµå µð·ºÅÍ¸® (FTP:»ó´ë°æ·Î SCP:Àý´ë°æ·Î ¿¹:/home): "
echo.
set /p FILE_SUFFIX="ÆÄÀÏ ±¸ºÐ¿ë Á¢¹Ì»ç (¿¹:system_activity_Á¢¹Ì»ç.log): "
cls
echo.
echo ÀÔ·Â³»¿ëÀ» È®ÀÎÇÕ´Ï´Ù.
echo.
echo ¼­¹ö ¿¬°á ¹æ½Ä(1.FTP 2.SCP 3.WebDAV): %CONN_TYPE%
echo ¼­¹ö ÁÖ¼Ò: %SERVER_IP%
echo Æ÷Æ® ¹øÈ£(°ø¶õÀÏ °æ¿ì ±âº»Æ÷Æ® »ç¿ë): %PORT_NUM%
echo ID: %USER_ID%
echo PW: %USER_PW%
echo ¾÷·Îµå µð·ºÅÍ¸®: %REMOTE_DIR%
echo Á¢¹Ì»ç: %FILE_SUFFIX%
echo.
choice /c YN /m "ÁøÇà ÇÏ½Ã°Ú½À´Ï±î? (N:´Ù½Ã ÀÛ¼º)"
if %errorlevel%==2 (
goto upload_input
)
if exist "%SystemDrive%\PCActivityLog\upload.bat" (
echo ±âÁ¸ upload.bat ÆÄÀÏ Á¦°Å
attrib -h -s -r %SystemDrive%\PCActivityLog\upload.bat
del %SystemDrive%\PCActivityLog\upload.bat
timeout /t 1 /nobreak >nul
)
set DEPLOY_DIR=%SystemDrive%\PCActivityLog
set LOG_PATH=%DEPLOY_DIR%\system_activity.log
set UPLOAD_BAT=%DEPLOY_DIR%\upload.bat
if not exist "%DEPLOY_DIR%" (
echo.
echo PCActivityLog Æú´õ°¡ ¾ø½À´Ï´Ù.
echo PCActivityLog ÇÁ·Î±×·¥ ¼³Ä¡ÈÄ ´Ù½Ã ÁøÇàÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.
echo.
pause
goto mainreset
)
echo @echo off > "%UPLOAD_BAT%"
if "%CONN_TYPE%"=="1" goto MAKE_FTP
if "%CONN_TYPE%"=="2" goto MAKE_SCP
if "%CONN_TYPE%"=="3" goto MAKE_WEBDAV
goto mainreset
:MAKE_FTP
if "%PORT_NUM%"=="" set PORT_NUM=21
echo copy %LOG_PATH% %DEPLOY_DIR%\system_activity_%FILE_SUFFIX%.log >> "%UPLOAD_BAT%"
echo curl -u "%USER_ID%:%USER_PW%" -X "DELE system_activity_%FILE_SUFFIX%.log" ftp://%SERVER_IP%:%PORT_NUM%%REMOTE_DIR% >> "%UPLOAD_BAT%"
echo curl -u "%USER_ID%:%USER_PW%" -T "%DEPLOY_DIR%\system_activity_%FILE_SUFFIX%.log" ftp://%SERVER_IP%:%PORT_NUM%%REMOTE_DIR%/system_activity_%FILE_SUFFIX%.log >> "%UPLOAD_BAT%"
echo del "%DEPLOY_DIR%\system_activity_%FILE_SUFFIX%.log" >> "%UPLOAD_BAT%"
echo ¾÷·Îµå ½ºÅ©¸³Æ® »ý¼º ¿Ï·á: %UPLOAD_BAT%
timeout /t 1 /nobreak >nul
goto REG_SCHEDULER
:MAKE_SCP
:: 2. SCP ¹æ½Ä ÄÚµå »ý¼º
winget install sshpass-win32 --silent --disable-interactivity --accept-source-agreements --accept-package-agreements --scope machine
if "%PORT_NUM%"=="" set PORT_NUM=22
echo copy %LOG_PATH% %DEPLOY_DIR%\system_activity_%FILE_SUFFIX%.log >> "%UPLOAD_BAT%"
echo sshpass -p %USER_PW% scp -P %PORT_NUM% %DEPLOY_DIR%\system_activity_%FILE_SUFFIX%.log %USER_ID%@%SERVER_IP%:%REMOTE_DIR% >> "%UPLOAD_BAT%"
echo del "%DEPLOY_DIR%\system_activity_%FILE_SUFFIX%.log" >> "%UPLOAD_BAT%"
echo ¾÷·Îµå ½ºÅ©¸³Æ® »ý¼º ¿Ï·á: %UPLOAD_BAT%
timeout /t 1 /nobreak >nul
goto REG_SCHEDULER
:MAKE_WEBDAV
:: 3. WebDAV ¹æ½Ä ÄÚµå »ý¼º
if "%PORT_NUM%"=="" set PORT_NUM=80
echo copy %LOG_PATH% %DEPLOY_DIR%\system_activity_%FILE_SUFFIX%.log >> "%UPLOAD_BAT%"
echo curl -u "%USER_ID%:%USER_PW%" -X DELETE http://%SERVER_IP%:%PORT_NUM%%REMOTE_DIR%/system_activity.log >> "%UPLOAD_BAT%"
echo curl -u "%USER_ID%:%USER_PW%" -T "%DEPLOY_DIR%\system_activity_%FILE_SUFFIX%.log" http://%SERVER_IP%:%PORT_NUM%%REMOTE_DIR%/system_activity.log >> "%UPLOAD_BAT%"
echo del "%DEPLOY_DIR%\system_activity_%FILE_SUFFIX%.log" >> "%UPLOAD_BAT%"
echo ¾÷·Îµå ½ºÅ©¸³Æ® »ý¼º ¿Ï·á: %UPLOAD_BAT%
timeout /t 1 /nobreak >nul
goto REG_SCHEDULER
:REG_SCHEDULER
echo.
echo ¼­¹ö¿¡ ·Î±×ÆÄÀÏ ¾÷·Îµå ÀÛ¾÷À» ÀÛ¾÷ ½ºÄÉÁÙ·¯¿¡ µî·ÏÇÕ´Ï´Ù. 
choice /c YN /m "ÀÛ¾÷ ½ºÄÉÁÙ·¯¿¡ µî·ÏÀ» ÁøÇà ÇÏ½Ã°Ú½À´Ï±î?"
if %errorlevel%==2 (
:: upload.batÆÄÀÏ ¼û±èÆÄÀÏ ¼Ó¼ºÀ¸·Î º¯°æ
attrib +h "%UPLOAD_BAT%"
goto mainreset
)
echo.
echo ¾÷·Îµå ÁÖ±â¸¦ ¼±ÅÃÇÏ¼¼¿ä:
echo  1. 1ºÐ ÁÖ±â
echo  2. 10ºÐ ÁÖ±â
echo  3. 1½Ã°£ ÁÖ±â
echo  4. PC ½ÃÀÛ ½Ã (ºÎÆÃ ÈÄ 1È¸ Àü¼Û)
set /p UPLOAD_CYCLE="¼±ÅÃ (1~4): "
echo.
echo ÀÛ¾÷ ½ºÄÉÁÙ·¯ µî·ÏÀ» ÁøÇàÇÕ´Ï´Ù...
set TASK_NAME="PC_Activity_Log_Uploader"
schtasks /delete /tn %TASK_NAME% /f >nul 2>&1
if "%UPLOAD_CYCLE%"=="1" (
    schtasks /create /tn %TASK_NAME% /tr "\"%UPLOAD_BAT%\"" /sc minute /mo 1 /ru "SYSTEM" /rl HIGHEST /f
    goto SUCCESS
)
if "%UPLOAD_CYCLE%"=="2" (
    schtasks /create /tn %TASK_NAME% /tr "\"%UPLOAD_BAT%\"" /sc minute /mo 10 /ru "SYSTEM" /rl HIGHEST /f
    goto SUCCESS
)
if "%UPLOAD_CYCLE%"=="3" (
    schtasks /create /tn %TASK_NAME% /tr "\"%UPLOAD_BAT%\"" /sc minute /mo 60 /ru "SYSTEM" /rl HIGHEST /f
    goto SUCCESS
)
if "%UPLOAD_CYCLE%"=="4" (
    schtasks /create /tn %TASK_NAME% /tr "\"%UPLOAD_BAT%\"" /sc onlogon /ru "SYSTEM" /rl HIGHEST /f
    goto SUCCESS
)
:SUCCESS
if %errorlevel% equ 0 (
    echo.
    echo ÀÛ¾÷ ½ºÄÉÁÙ·¯¿¡ '%TASK_NAME%' µî·ÏÀÌ ¿Ï·áµÇ¾ú½À´Ï´Ù!
) else (
    echo.
    echo [¿À·ù] ÀÛ¾÷ ½ºÄÉÁÙ·¯ µî·Ï¿¡ ½ÇÆÐÇß½À´Ï´Ù.
    pause
)
)
echo.
echo ¼³Ä¡ ¿Ï·á.
timeout /t 3 /nobreak >nul
:: upload.batÆÄÀÏ ¼û±èÆÄÀÏ ¼Ó¼ºÀ¸·Î º¯°æ
attrib +h "%UPLOAD_BAT%"
goto thdpagereset

:: =======================================================
:defender
start windowsdefender://threatsettings
goto fourthpagereset

:: =======================================================
:winupdateoff
mode con: cols=120 lines=27
cls
echo !120bar!
echo [100m[1mÀ©µµ¿ì ¾÷µ¥ÀÌÆ® ²ô±â[0m[1m
    set "DL_URL=https://jins.kr/app/Wub/Wub.exe"
    set "DL_FILE=Wub.exe"
    set "DL_DEST=%TEMP%\!DL_FILE!"
    call :download_file "!DL_URL!" "!DL_FILE!" "!DL_DEST!"
    set "DL_URL=https://jins.kr/app/Wub/Wub.ini"
    set "DL_FILE=Wub.ini"
    set "DL_DEST=%TEMP%\!DL_FILE!"
    call :download_file "!DL_URL!" "!DL_FILE!" "!DL_DEST!"
cd %TEMP%
start /wait Wub.exe
goto fourthpagereset

:: =======================================================
:activated
mode con: cols=120 lines=27
cls
echo !120bar!
echo [100m[1mWindows activated ½ÇÇà[0m[1m
powershell -Command "irm https://get.activated.win | iex"
goto fourthpagereset

:: =======================================================
:wpd
mode con: cols=120 lines=27
cls
echo !120bar!
echo [100m[1mWPD ´Ù¿î·Îµå[0m[1m
    set "DL_URL=https://wpd.app/get/latest.zip"
    set "DL_FILE=latest.zip"
    set "DL_DEST=%TEMP%\!DL_FILE!"
    call :download_file "!DL_URL!" "!DL_FILE!" "!DL_DEST!"
timeout /t 1 /nobreak >nul
echo.
echo [100m[1mWPD ¾ÐÃàÇØÁ¦[0m[1m
tar -xvf "%TEMP%\latest.zip" -C "%TEMP%"
timeout /t 2 /nobreak >nul
echo.
echo [100m[1mWPD ½ÇÇà[0m[1m
start "" "%TEMP%\WPD.exe"
timeout /t 3 /nobreak >nul
goto fourthpagereset

:: =======================================================
:exit
exit

:: =======================================================
:: ´Ù¿î·Îµå ÇÔ¼ö
:: =======================================================
:download_file
set "URL=%~1"
set "FILENAME=%~2"
set "DESTPATH=%~3"

:: º¯¼ö ÃÊ±âÈ­
set "C_SIZE=0"
set "C_PCT=0"
set "C_MB=0"
set "T_MB=0"

:: ÆÄÀÏ Á¤º¸ °¡Á®¿À±â (PowerShell) - TLS 1.2 °­Á¦ ¹× ¿À·ù Á¦¾î
for /f %%A in ('powershell -command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $req = [Net.WebRequest]::Create('%URL%'); $req.Method = 'HEAD'; try{$res = $req.GetResponse(); $res.ContentLength; $res.Dispose()}catch{0}"') do set "TS=%%A"
if "%TS%"=="" set "TS=1"
for /f %%A in ('powershell -command "[math]::Floor(%TS% / 1MB)"') do set "T_MB=%%A"

echo %FILENAME% ´Ù¿î·Îµå Áß...
start /b "" curl -s -L "%URL%" -o "%DESTPATH%" >nul 2>&1

:: ½Ã°£ °ø¹é Á¦°Å ·ÎÁ÷ Ãß°¡
set "t=%time: =0%"
set /a "h=1%t:~0,2% %% 100, m=1%t:~3,2% %% 100, s=1%t:~6,2% %% 100"
set /a T_START=h*3600 + m*60 + s

:dl_loop
timeout /t 1 /nobreak >nul
if not exist "%DESTPATH%" goto dl_loop

:: ÇöÀç Å©±â ¹× ÆÛ¼¾Æ® °è»ê
for /f "tokens=1,2,3" %%A in ('powershell -command "$cur = (Get-Item '%DESTPATH%').Length; $total = %TS%; $pct = [math]::Floor(($cur / $total) * 100); $curmb = [math]::Floor($cur / 1MB); echo \"$cur $pct $curmb\""') do (
    set "C_SIZE=%%A"
    set "C_PCT=%%B"
    set "C_MB=%%C"
)

:: °ªÀÌ ºñ¾îÀÖÀ» °æ¿ì¸¦ ´ëºñÇÑ ±âº»°ª ÇÒ´ç
if "%C_PCT%"=="" set "C_PCT=0"
if "%C_MB%"=="" set "C_MB=0"

:: ÇÁ·Î±×·¹½º ¹Ù °è»ê
set /a B_LEN=C_PCT / 2
set /a E_LEN=50 - B_LEN

set "t=%time: =0%"
set /a "h=1%t:~0,2% %% 100, m=1%t:~3,2% %% 100, s=1%t:~6,2% %% 100"
set /a T_NOW=h*3600 + m*60 + s
set /a ELAPSED=T_NOW - T_START
if %ELAPSED% LSS 1 set ELAPSED=1
set /a SPD=C_MB / ELAPSED

set "F_STR="
if %B_LEN% gtr 0 for /l %%i in (1,1,%B_LEN%) do set "F_STR=!F_STR! "
set "E_STR="
if %E_LEN% gtr 0 for /l %%i in (1,1,%E_LEN%) do set "E_STR=!E_STR! "

<nul set /p ="[2K[0G[44m!F_STR![100m!E_STR![0m  !C_MB!MB / !T_MB!MB (!C_PCT!%%, !SPD!MB/s)"

if "%C_SIZE%" equ "%TS%" goto dl_done
if %C_PCT% geq 100 goto dl_done
goto dl_loop

:dl_done
echo.
timeout /t 2 /nobreak >nul
for %%A in ("!DESTPATH!") do (
    if %%~zA gtr 0 (
        echo !FILENAME! ´Ù¿î·Îµå ¼º°ø...
    ) else (
        echo !FILENAME! ´Ù¿î·Îµå ½ÇÆÐ...
        choice /c YN /m "´Ù½Ã ´Ù¿î·Îµå ÇÏ½Ã°Ú½À´Ï±î?"
        if errorlevel 2 (
          echo ´Ù¿î·Îµå Ãë¼ÒµÊ...
        ) else (
          goto download_file
        )
    )
)
exit /b

:: =======================================================
:: winget ¹× choco ¼³Ä¡ ÇÔ¼ö
:: =======================================================
:instpg
set "pgtitle=%~1"
set "wgtitle=%~2"
set "chotitle=%~3"
set "smode=%~4"
echo [100m[1m!pgtitle! ¼³Ä¡[0m[1m
winget --version >nul 2>&1
if not errorlevel 1 (
  winget search !wgtitle! | findstr /i "!wgtitle!" > nul
  if not errorlevel 1 (
    if "!smode!"=="on" (
      winget install !wgtitle! --silent --disable-interactivity --accept-source-agreements --accept-package-agreements --scope machine
    ) else (
      winget install !wgtitle! --interactive --accept-source-agreements --accept-package-agreements --scope machine
    )
    echo !pgtitle! ¼³Ä¡ È®ÀÎÁß...
    winget list !wgtitle! | findstr /i "!wgtitle!" > nul
    if not errorlevel 1 (
      echo !pgtitle! ¼³Ä¡ ¿Ï·á...
      timeout /t 1 /nobreak > nul
      goto instpg_done
    ) else (
      echo !pgtitle! ¼³Ä¡ ½ÇÆÐ...
      echo Chocolatey·Î !pgtitle! ¼³Ä¡ ½Ãµµ...
      goto ChoCoin
    )
  ) else (
    echo Winget¿¡ !pgtitle! ¾øÀ½...
    echo Chocolatey·Î !pgtitle! ¼³Ä¡ ½Ãµµ...
    goto ChoCoin
  )
) else (
echo Winget ÇÁ·Î±×·¥ÀÌ ¼³Ä¡µÇÁö ¾ÊÀ½...
echo Chocolatey·Î !pgtitle! ¼³Ä¡ ½Ãµµ...
goto ChoCoin
)

:ChoCoin
choco --version >nul 2>&1
if not errorlevel 1 (
  choco search !chotitle! | findstr /i "!chotitle!" > nul
  if not errorlevel 1 (
    if "!smode!"=="on" (
      choco install !chotitle! -y --verbose
    ) else (
      choco install !chotitle! --notsilent --verbose
    )
    echo !pgtitle! ¼³Ä¡ È®ÀÎÁß...
    choco list !chotitle! | findstr /i "!chotitle!" > nul
    if not errorlevel 1 (
      echo !pgtitle! ¼³Ä¡ ¿Ï·á...
      timeout /t 1 /nobreak > nul
      goto instpg_done
    ) else (
      echo !pgtitle! ¼³Ä¡ ½ÇÆÐ...
      pause
      goto instpg_done
    )
  ) else (
  echo Chocolatey¿¡ !pgtitle! ¾øÀ½...
  echo !pgtitle! ¼³Ä¡ ½ÇÆÐ...
  pause
  goto instpg_done
  )
) else (
echo Chocolatey ÇÁ·Î±×·¥ÀÌ ¼³Ä¡µÇÁö ¾ÊÀ½...
echo !pgtitle! ¼³Ä¡ ½ÇÆÐ...
pause
goto instpg_done
)

:instpg_done
exit /b