@echo off&mode con cols=74 lines=17
chcp 949
cls
:admincheck
net session > nul 2> nul
if not "%errorlevel%" == "0"  (
echo.
echo.
echo 
echo.
echo  관리자 권한으로 실행해 주세요.
echo.
echo 
echo.
echo.
timeout /t 5 > nul
goto exit
)
title 드라이버팩 통합 툴 v22.12 By Remiz

:newcard
cls
echo.
echo 
echo.
echo  [ 드라이버팩 통합 툴 v22.12 By Remiz ]
echo.
echo 
echo.
for /f "tokens=3-6 delims=: " %%a in ('WMIC LOGICALDISK GET FreeSpace^,Name^,Size^,filesystem^,description ^|FINDSTR /I "Removable" ^|findstr /i "exfat fat32"') do (@echo wsh.echo "Disk letter: %%c;" ^& " free: " ^& FormatNumber^(cdbl^(%%b^)/1024/1024/1024, 2^)^& " GB;"^& " size: " ^& FormatNumber^(cdbl^(%%d^)/1024/1024/1024, 2^)^& " GB;" ^& " FS: %%a" > %temp%\tmp.vbs & @if not "%%c"=="" @echo( & @cscript //nologo %temp%\tmp.vbs & del %temp%\tmp.vbs)
echo.
set /P sd="작업할 USB를 입력해주세요 (USB가 G드라이브면 g를 입력) : "

if not exist "%sd%:\" (     
	goto wrongsd
) else (
	if not exist "%sd%:\*" (goto wrongsd)
)

:main
cls
echo.
echo.
echo 
echo.
echo                  이전 드라이버팩 파일들을 제거 중입니다...                          
echo.
echo                     **시간이 다소 오래 걸릴수 있습니다**                
echo.
echo 

if exist "%sd%:\sources\$OEM$" (RD /s /q "%sd%:\sources\$OEM$")

cls
echo.
echo.
echo 
echo.
echo                        드라이버팩을 통합 중입니다...                   
echo.
echo                       **시간이 다소 오래 걸립니다**                
echo.
echo 
start /wait %~dp0\copy.bat
goto end

:wrongsd
cls
echo.
echo.
echo 
echo. 
echo        입력하신 USB 드라이버가 잘못되었습니다.
echo. 
echo        확인 후 다시 시도해 주세요~
echo. 
echo        아무키를 눌러 매인으로 돌아갑니다.
echo. 
echo 
pause >nul
goto newcard

:end
echo. 
cls
echo.
echo.
echo 
echo. 
echo                     드라이버팩 통합이 완료되었습니다.
echo. 
echo 
echo. 
echo. 
echo 아무 키를 눌러 종료합니다.
pause >nul
exit