@echo off

REM Did they forget quotes on a path with spaces?
if not "%2"=="" goto quit

title Creating ExpressSAS RAID Windows Driver Disk
echo.
echo Creating ExpressSAS RAID Windows Driver Disk
echo.

set DEST=%~f1
set DRIVE=%~d1
set COPYCMD=XCOPY /V /R /Y

if not "%DEST%"=="" goto ckdrive
set DEST=a:\
set DRIVE=a:

:ckdrive 
if /I "%DEST%"=="a:\" goto format
if /I "%DEST%"=="b:\" goto format
goto cpfiles

:format
echo CAUTION - All data on the diskette will be erased.
echo.

format /v:ESASRAID %DRIVE%

if errorlevel 1 goto quit

:cpfiles
mkdir %DEST%

if /I "%DRIVE%"=="a:" goto cpmini
if /I "%DRIVE%"=="b:" goto cpmini

:cpall
%COPYCMD% ..\SETUP.EXE      %DEST%

:cpmini

%COPYCMD% esasraid.*        %DEST%

cd ..

%COPYCMD% esasraid          %DEST%
%COPYCMD% ATTOMTLN.*        %DEST%
%COPYCMD% SETUP.EXE         %DEST%
%COPYCMD% TXTSETUP.OEM      %DEST%
%COPYCMD% README.HTM        %DEST%

:quit
