@echo off
color 1F
cd /d %~dp0
title KW Launcher Run
mode con cols=100 lines=25
echo.
echo.
echo
echo. 루트 경로에 EasyDrv or K-Driver 문자가 포함된 폴더를 찾아 설치를 시작합니다.
echo
echo 1. EasyDrv 경로 [내/외장] rootdrive:\EasyDrv**** or rootdrive:\WanDrv****
echo.
echo 2. K-Driver 경로 [외장] rootdrive:\K-Driver****
echo.
echo 3. Exit
echo
echo. 미선택시 10초 후 무작위로 자동 설치 됩니다.
echo
echo.
CHOICE /C:123 /T 10 /D:3 /M "Pick a Number 1 or 2 or 3"
IF ERRORLEVEL 3 GOTO usb
IF ERRORLEVEL 2 GOTO Bitcheck2
IF ERRORLEVEL 1 GOTO Bitcheck1
:usb
for %%a in (Z Y X W V U T S R Q P O N M L K J I H G F E D C B A) do (
for /F "tokens=*" %%b in ('"dir /a:d /b "%%a:\EasyDrv*""') do (set usb=%%a&set folder=%%b& goto :Bitcheck1)
)
for %%a in (Z Y X W V U T S R Q P O N M L K J I H G F E D C B A) do (
for /F "tokens=*" %%b in ('"dir /a:d /b "%%a:\K-Driver*""') do (set usb=%%a&set folder=%%b& goto :Bitcheck2)
)
:Bitcheck1
setlocal enabledelayedexpansion
if /i "%PROCESSOR_ARCHITECTURE%"=="AMD64" (set bit=x64) else (set bit=x86)&
if /i "%cd%"=="%Windir%\Setup\Scripts" if %bit%==x86 if exist "%tmp%\완료.txt" goto :exit
if /i "%cd%"=="%Windir%\Setup\Scripts" goto :next
:next
echo.
echo.
echo
echo. EasyDrv 설치합니다
echo
echo.
ping localhost -n 3 >nul
:ver
for /F "tokens=1-2 delims=." %%a in ('ver') do set major=%%a& set winver=!major:~-2!.%%b
if "%winver%"==" 5.0" (set win=2000&set win=WinXP& goto :usb)
if "%winver%"==" 5.1" (set win=XP&set win=WinXP& goto :usb)
if "%winver%"==" 5.2" (set win=2003&set win=WinXP& goto :usb)
if "%winver%"==" 6.0" (set win=Vista&set win=Win7& goto :usb)
if "%winver%"==" 6.1" (set win=7&set win=Win7& goto :usb)
if "%winver%"==" 6.2" (set win=8&set win=Win10& goto :usb)
if "%winver%"==" 6.3" (set win=8.1&set win=Win10& goto :usb)
if "%winver%"=="10.0" (set win=10&set win=Win10& goto :usb)
cls
echo.
echo.
echo
echo. 지원하는 Windows 가 아닙니다
echo
echo.
ping localhost -n 7 >nul
exit
:usb
for %%a in (Z Y X W V U T S R Q P O N M L K J I H G F E D C B A) do (
for /F "tokens=*" %%b in ('"dir /a:d /b "%%a:\EasyDrv*""') do (set usb=%%a&set folder=%%b& goto :find)
)
cls
echo.
echo.
echo
echo. 각 드라이브 루트에 EasyDrv나 WanDrv가 포함된 폴더가 없습니다
echo
echo.
ping localhost -n 7 >nul
goto Bitcheck2
:find
cls
echo.
echo.
echo
echo. %win%.%bit% 찾아서 설치 중 입니다
echo
echo.
for /F "tokens=*" %%a in ('"dir /a:-d /b /s "%usb%:\%folder%\*%win%.%bit%*.exe""') do set exe=%%a& goto :run
cls
echo.
echo.
echo
echo. "%usb%:\%folder%" 에서 "%win%.%bit%" 가 포함된 exe 파일을 찾지 못 했습니다
echo
echo.
ping localhost -n 7 >nul
exit
:run
"%exe%" /a /c /r
if /i "%cd%"=="%Windir%\Setup\Scripts" if %bit%==x64 (echo.>"%tmp%\완료.txt"& exit)
if /i "%cd%"=="%Windir%\Setup\Scripts" del /f/a/q "%~0"
exit
:Bitcheck2
setlocal enabledelayedexpansion
if /i "%PROCESSOR_ARCHITECTURE%"=="AMD64" (set bit=64Bit) else (set bit=32Bit)
if /i "%cd%"=="%Windir%\Setup\Scripts" if %bit%==32Bit if exist "%tmp%\완료.txt" goto :exit
if /i "%cd%"=="%Windir%\Setup\Scripts" goto :next1
:next1
echo.
echo.
echo
echo. K-Driver 설치합니다
echo
echo.
ping localhost -n 3 >nul
:ver1
for /F "tokens=1-2 delims=." %%a in ('ver') do set major=%%a& set winver=!major:~-2!.%%b
if "%winver%"==" 5.0" (set win=2000&set win=XP2K& goto :usb1)
if "%winver%"==" 5.1" (set win=XP&set win=XP2K& goto :usb1)
if "%winver%"==" 5.2" (set win=2003&set win=XP2KP& goto :usb1)
if "%winver%"==" 6.0" (set win=Vista&set win=Win7& goto :usb1)
if "%winver%"==" 6.1" (set win=7&set win=Win7& goto :usb1)
if "%winver%"==" 6.2" (set win=8&set win=Win8& goto :usb1)
if "%winver%"==" 6.3" (set win=8.1&set win=Win8& goto :usb1)
if "%winver%"=="10.0" (set win=10&set win=WinT& goto :usb1)
cls
echo.
echo.
echo
echo. 지원하는 Windows 가 아닙니다
echo
echo.
ping localhost -n 7 >nul
exit
:usb1
for %%a in (Z Y X W V U T S R Q P O N M L K J I H G F E D C B A) do (
for /F "tokens=*" %%b in ('"dir /a:d /b "%%a:\K-Driver*""') do (set usb=%%a&set folder=%%b& goto :find1)
)
cls
echo.
echo.
echo
echo. 각 드라이브 루트에 K-Driver가 포함된 폴더가 없습니다
echo
echo.
ping localhost -n 7 >nul
exit
:find1
cls
echo.
echo.
echo
echo. %win%.%bit% 찾아서 설치 중 입니다
echo
echo.
for /F "tokens=*" %%a in ('"dir /a:-d /b /s "%usb%:\%folder%\*%win%.%bit%*.exe""') do set exe=%%a& goto :run1
cls
echo.
echo.
echo
echo. "%usb%:\%folder%" 에서 "%win%.%bit%" 가 포함된 exe 파일을 찾지 못 했습니다
echo
echo.
ping localhost -n 7 >nul
exit
:run1
"%exe%" /a /c /r
if /i "%cd%"=="%Windir%\Setup\Scripts" if %bit%==x64 (echo.>"%tmp%\완료.txt"& exit)
if /i "%cd%"=="%Windir%\Setup\Scripts" del /f/a/q "%~0"
exit
:exit
if exist "%tmp%\완료.txt" del /f/a/q "%tmp%\완료.txt"
del /f/a/q "%~0"
exit