mkboot.cmd
@echo off
:: MAKE USB DISK MS DOS BOOTABLE
:: USES XP SYSTEM32 FOLDER OR XP SETUP SOURCE
:: CHANGE USER SETTINGS BELOW
:_setting
SET USBDRV=R:
SET XPSRC=C:\i386
SET USESRC=NO
:_load
CLS
ECHO ALL FILES WILL BE DELETED ON USB DRIVE %USBDRV%
ECHO CLICK THE [X] AT THE TOP RIGHT TO EXIT NOW OR ...
PAUSE
CLS
:_chkusb
:: CHECK USB DRIVE
ECHO checking USB Drive %USBDRV% ..
IF NOT EXIST %USBDRV%\CON GOTO _ERR
IF %USBDRV%==C: GOTO _ERR
IF %USBDRV%==c: GOTO _ERR
:_chksrc1
:: CHECK XP SOURCE
ECHO checking XP source ..
IF %USESRC%==YES GOTO _chksrc2
IF NOT EXIST %windir%\system32\diskcopy.dll GOTO _ERR
IF NOT EXIST %windir%\system32\expand.exe GOTO _ERR
GOTO _chksys
:_chksrc2
IF NOT EXIST %XPSRC%\diskcopy.dl_ GOTO _ERR
IF NOT EXIST %XPSRC%\expand.exe GOTO _ERR
:_chksys
:: CHECK REQUIRED FILES
ECHO checking required files ..
IF NOT EXIST SYSTEM\XPBTDSK.EXE GOTO _ERR
IF NOT EXIST SYSTEM\DCFR.COM GOTO _ERR
IF NOT EXIST SYSTEM\HPUSBF.EXE GOTO _ERR
IF NOT EXIST tmp\CON MD tmp
DEL /Q tmp\*.*
IF NOT EXIST tmp\CON GOTO _ERR
:_mkfiles1
ECHO start create boot files ..
IF %USESRC%==YES GOTO _mkfiles2
COPY /y %windir%\system32\diskcopy.dll tmp\diskcopy.dll
GOTO _mkfiles3
:_mkfiles2
%XPSRC%\EXPAND %XPSRC%\diskcopy.dl_ -F:diskcopy.dll tmp\diskcopy.dll
:_mkfiles3
ECHO extracting bootdisk ..
SYSTEM\XPBTDSK.EXE tmp\diskcopy.dll tmp\bootdisk.tmp
IF NOT EXIST tmp\bootdisk.tmp GOTO _ERR
ECHO extracting files from bootdisk ..
SYSTEM\DCFR.COM -e tmp\bootdisk.tmp COMMAND.COM IO.SYS MSDOS.SYS tmp
IF EXIST tmp\diskcopy.dll DEL tmp\diskcopy.dll
IF EXIST tmp\bootdisk.tmp DEL tmp\bootdisk.tmp
:_chkboot
:: CHECK BOOT FILES CREATED
IF NOT EXIST TMP\COMMAND.COM GOTO _ERR
IF NOT EXIST TMP\IO.SYS GOTO _ERR
IF NOT EXIST TMP\MSDOS.SYS GOTO _ERR
ECHO boot files extracted okay
:_chkformat1
:: CHECK FORMAT EXISTS IN SYSTEM FOLDER
ECHO checking format.com ..
IF %USESRC%==YES GOTO _chkformat2
IF NOT EXIST %windir%\system32\format.com ECHO format.com does not exist
IF NOT EXIST %windir%\system32\format.com GOTO _hpformat
COPY /y %windir%\system32\format.com tmp\format.com
IF NOT EXIST tmp\format.com GOTO _hpformat
ECHO format.com copied okay
GOTO _xpformat
:_chkformat2
:: TRY EXPAND FROM XP SOURCE
IF EXIST %XPSRC%\format.co_ %XPSRC%\EXPAND %XPSRC%\format.co_ -F:format.com tmp\format.com
IF NOT EXIST tmp\format.com ECHO format.com not extracted
IF NOT EXIST tmp\format.com GOTO _hpformat
ECHO format.com extracted okay
:_xpformat
ECHO formatting with xp format.com ..
tmp\format.com %USBDRV% /FS:FAT32 /q /u /backup /v:ETOOLS /x
:_hpformat
ECHO formatting with HP USB format ..
SYSTEM\HPUSBF %USBDRV% -FS:FAT32 -V:ETOOLS -B:TMP -Y
:_copydos
IF NOT EXIST %windir%\system32\xcopy.exe GOTO _EXIT
IF EXIST ADDDOS\CON ECHO copying custom DOS files ..
IF EXIST ADDDOS\CON %windir%\system32\xcopy.exe ADDDOS\*.* %USBDRV%\ /i /k /e /r /y /h
GOTO _EXIT
:_ERR
IF EXIST TMP\CON RD /S /Q TMP
ECHO ERROR!!
PAUSE
EXIT
:_EXIT
IF EXIST TMP\CON RD /S /Q TMP
ECHO.
ECHO Completed Okay
PAUSE
EXIT
No comments:
Post a Comment