Home Page Bahamas Software Bahamas Real Estate Bahamas Writer Business Services Contact Us
Video Surveillance . CCTV . Infrared . DVR . Digital Video Recorder . Remote Video . Wireless . IP . Burglar Alarm . Software . VB6 . VBScripts . Computer . Technician
Make USB Disk Bootable

This creates a MS-DOS Bootable USB Drive from the users XP source files.

** THIS IS FOR INFORMATION ONLY - USE AT YOUR OWN RISK **

The default setting uses the Windows XP System32 folder. Optionally the user can change the option within the file to use an XP setup source. As a result no MS-DOS boot files have to be distributed with this as they are extracted from a boot disk included with XP, which is actually a modified Windows Me DOS Boot disk.

This uses the HP USB Dos format tool to make the disk bootable, and that file is not included and is copyright HP.

In addition, this will download and run the HP USB DOS format tool setup (use defaults, just click next) if you dont already have that file. This is downloaded direct from an HP web site. You must accept the HP End User License Agreement during setup.

You will require ADMIN privileges on your Windows computer.

The process is as follows:

Create temp folder in working folder
Download/Install/Copy HP USB Dos Format Tool
Extract Boot files from diskcopy.dll into a temp folder
Extract/Copy Format.com into a temp folder
Run Format.com and dismount USB drive
Run HP Format tool and make USB drive bootable
Remove temp folder

READ ME
------------------

1 - Copy these files to a sub folder called SYSTEM:
===========================================

dlhp.vbs
DCFR.COM
XPBTDSK.EXE

Download these 3 files here (3488 downloads)

HPUSBF.EXE - optional
http://h50178.www5.hp.com/support/470035-692/more_info_local_17017.html


If you already have the HP USB Dos Format Tool, copy that also.
This is optional as the script will download if it does not exist.
If it must download when it auto runs set up choose the defaults.

DCFR - download separately with read me
ftp://ftp.sac.sk/pub/sac/utildisk/dcfr004.zip

XPBTDSK - more information
http://www.911cd.net/forums/index.php?showtopic=16745&st=20

2 - RUN BATCH SCRIPT:
===========================================

Change USBDRV value R: to the letter of your USB Drive.
Exit and Save then click on Batch File.

** MAKE SURE THE USB DRIVE LETTER IS CORRECT **

Download the ready made package if you want to skip all the details:
Download Now
(1812 downloads)

BATCH FILE
------------------

Make new Text file and rename it something.cmd (whatever you want to name it, .cmd)
Right click EDIT then place the following into it, change the USB Drive letter, and save.

Optional:
Place custom DOS files and folders in a sub folder called ADDDOS and they will be copied to the USB Drive.

@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\dlhp.vbs GOTO _ERR
   IF NOT EXIST tmp\CON MD tmp
   DEL /Q tmp\*.*
   IF NOT EXIST tmp\CON GOTO _ERR

:_hptool

   IF EXIST SYSTEM\HPUSBF.EXE GOTO _mkfiles1
   IF EXIST %systemdrive%\DriveKey\HPUSBF.EXE COPY /y %systemdrive%\DriveKey\HPUSBF.EXE SYSTEM\HPUSBF.EXE
   IF EXIST SYSTEM\HPUSBF.EXE GOTO _mkfiles1

   :: DOWNLOAD HP FORMAT TOOL
   ECHO downloading HP USB format tool ..
   Start /wait SYSTEM\dlhp.vbs

   IF NOT EXIST SYSTEM\SP27214.exe ECHO download failed
   IF NOT EXIST SYSTEM\SP27214.exe GOTO _ERR
   ECHO download completed okay ..

   ECHO running HP USB format tool setup ..
   Start /wait SYSTEM\SP27214.exe
   IF NOT EXIST %systemdrive%\DriveKey\HPUSBF.EXE GOTO _ERR
   IF EXIST %systemdrive%\DriveKey\HPUSBF.EXE COPY /y %systemdrive%\DriveKey\HPUSBF.EXE SYSTEM\HPUSBF.EXE
   IF NOT EXIST SYSTEM\HPUSBF.EXE GOTO _ERR

:_mkfiles1

   ECHO HP USB format tool installed ..
   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


dlhp.vbs

------------------------------

This is available in the download  above, but I will post the code here for reference.

Option Explicit

'// VBS DOWNLOADER BY RORY KNOWLES 2006
'// MODIFIED SEPT 29, 2008 FOR EEE PC DOS TOOLS
'// POPUP ALERT ON ERROR

'// SETTINGS
Const sProgram = "Download/Setup HP USB Format Tool"
Const sRemote  = "http://h50178.www5.hp.com/local_drivers/17017/SP27214.exe"

'// DECLARATIONS
Dim ScriptPath, sLocal
ScriptPath = CreateObject("Scripting.FileSystemObject")._
GetParentFolderName(Wscript.ScriptFullName)
sLocal = ScriptPath & "\" & Right(sRemote, Len(sRemote) - InstrRev(sRemote,"/"))

'// START DOWNLOAD
Call GetFile(sRemote, sLocal)

'// DOWNWLOAD FILE
Sub GetFile(Src, Dest)
    Dim objHttp, Status, Text
    On Error Resume Next
    Set objHttp = CreateObject("Microsoft.XMLHTTP")
    objHttp.Open "GET", Src, False
    If Err = 0 Then
        objHttp.Send ""  
        Status = objHttp.Status
        Text = HTTPResponse(Status)
        If Status <> 200 Then
            MsgBox "RESPONSE ERROR" & _
            vbCrLf & Status & ": " & Text, vbCritical, sProgram
        Else      
        Call PutFile(objHttp, Dest) 
        End If             
    Else
        MsgBox "Download Error!" & _
        vbCrLf & Err.Description, vbCritical, sProgram
    End If    
    Set objHttp = Nothing
End Sub

'// WRITE TO LOCAL FILE
Sub PutFile(objHttp, Dest)
    Dim objStream
    On Error Goto 0
    On Error Resume Next
    Set objStream = Createobject("Adodb.Stream")
        objStream.Type = 1
        objStream.Open
        objStream.Write objHttp.ResponseBody
        objStream.Savetofile Dest, 2
        objStream.Close
    Set objStream = Nothing
    If Err Then
        MsgBox "File Error!" & _
        vbCrLf & Err.Description, vbCritical, sProgram
    Else
        '// DOWNLOAD COMPLETE
    End If
End Sub
   
'// 2006 RORYK
Function HTTPResponse(ByVal iCode)
    Dim tmp: Select Case iCode
        Case 200: tmp = "OK"
        Case 201: tmp = "CREATED"
        Case 202: tmp = "ACCEPTED"
        Case 203: tmp = "NON-AUTHORITATIVE INFORMATION"
        Case 204: tmp = "NO CONTENT"
        Case 205: tmp = "RESET CONTENT"
        Case 206: tmp = "PARTIAL CONTENT"
        Case 300: tmp = "MULTIPLE CHOICES"
        Case 301: tmp = "MOVED PERMANENTLY"
        Case 302: tmp = "FOUND"
        Case 303: tmp = "SEE OTHER"
        Case 304: tmp = "NOT MODIFIED"
        Case 305: tmp = "USE PROXY"
        Case 306: tmp = "UNUSED"
        Case 307: tmp = "TEMPORARY REDIRECT"
        Case 400: tmp = "BAD REQUEST"
        Case 401: tmp = "NAUTHORIZED"
        Case 402: tmp = "PAYMENT REQUIRED"
        Case 403: tmp = "FORBIDDEN"
        Case 404: tmp = "NOT FOUND"
        Case 405: tmp = "METHOD NOT ALLOWED"
        Case 406: tmp = "NOT ACCEPTABLE"
        Case 407: tmp = "PROXY AUTHENTICATION REQUIRED"
        Case 408: tmp = "REQUEST TIMEOUT"
        Case 409: tmp = "CONFLICT"
        Case 410: tmp = "GONE"
        Case 411: tmp = "LENGTH REQUIRED"
        Case 412: tmp = "PRECONDITION FAILED"
        Case 413: tmp = "REQUEST ENTITY TOO LARGE"
        Case 414: tmp = "REQUEST-URI TOO LONG"
        Case 415: tmp = "UNSUPPORTED MEDIA TYPE"
        Case 416: tmp = "REQUESTED RANGE NOT SATISFIABLE"
        Case 417: tmp = "EXPECTATION FAILED"
        Case 500: tmp = "INTERNAL SERVER ERROR"
        Case 501: tmp = "NOT IMPLEMENTED"
        Case 502: tmp = "BAD GATEWAY"
        Case 503: tmp = "SERVICE UNAVAILABLE"
        Case 504: tmp = "GATEWAY TIMEOUT"
        Case 505: tmp = "HTTP VERSION NOT SUPPORTED"
        Case 12000: tmp = "ERROR BASE"
        Case 12001: tmp = "OUT OF HANDLES"
        Case 12002: tmp = "TIMEOUT"
        Case 12003: tmp = "EXTENDED ERROR"
        Case 12004: tmp = "INTERNAL ERROR"
        Case 12005: tmp = "INVALID URL"
        Case 12006: tmp = "UNRECOGNIZED SCHEME"
        Case 12007: tmp = "NAME NOT RESOLVED"
        Case 12008: tmp = "PROTOCOL NOT FOUND"
        Case 12009: tmp = "INVALID OPTION"
        Case 12010: tmp = "BAD OPTION LENGTH"
        Case 12011: tmp = "OPTION NOT SETTABLE"
        Case 12012: tmp = "SHUTDOWN"
        Case 12013: tmp = "INCORRECT USER NAME"
        Case 12014: tmp = "INCORRECT PASSWORD"
        Case 12015: tmp = "LOGIN FAILURE"
        Case 12016: tmp = "INVALID OPERATION"
        Case 12017: tmp = "OPERATION CANCELLED"
        Case 12018: tmp = "INCORRECT HANDLE TYPE"
        Case 12019: tmp = "INCORRECT HANDLE STATE"
        Case 12020: tmp = "NOT PROXY REQUEST"
        Case 12021: tmp = "REGISTRY VALUE NOT FOUND"
        Case 12022: tmp = "BAD REGISTRY PARAMETER"
        Case 12023: tmp = "NO DIRECT ACCESS"
        Case 12024: tmp = "NO CONTEXT"
        Case 12025: tmp = "NO CALLBACK"
        Case 12026: tmp = "REQUEST PENDING"
        Case 12027: tmp = "INCORRECT FORMAT"
        Case 12028: tmp = "ITEM NOT FOUND"
        Case 12029: tmp = "CANNOT CONNECT"
        Case 12030: tmp = "CONNECTION ABORTED"
        Case 12031: tmp = "CONNECTION RESET"
        Case 12032: tmp = "FORCE RETRY"
        Case 12033: tmp = "INVALID PROXY REQUEST"
        Case 12034: tmp = "NEED UI"
        Case 12036: tmp = "HANDLE EXISTS"
        Case 12037: tmp = "SEC CERT DATE INVALID"
        Case 12038: tmp = "SEC CERT CN INVALID"
        Case 12039: tmp = "HTTP TO HTTPS ON REDIR"
        Case 12040: tmp = "HTTPS TO HTTP ON REDIR"
        Case 12041: tmp = "MIXED SECURITY"
        Case 12042: tmp = "CHG POST IS NON SECURE"
        Case 12043: tmp = "POST IS NON SECURE"
        Case 12044: tmp = "CLIENT AUTH CERT NEEDED"
        Case 12045: tmp = "INVALID CA"
        Case 12046: tmp = "CLIENT AUTH NOT SETUP"
        Case 12047: tmp = "ASYNC THREAD FAILED"
        Case 12048: tmp = "REDIRECT SCHEME CHANGE"
        Case 12049: tmp = "DIALOG PENDING"
        Case 12050: tmp = "RETRY DIALOG"
        Case 12052: tmp = "HTTPS HTTP SUBMIT REDIR"
        Case 12053: tmp = "INSERT CDROM"
        Case 12054: tmp = "FORTEZZA LOGIN NEEDED"
        Case 12055: tmp = "SEC CERT ERRORS"
        Case 12056: tmp = "SEC CERT NO REV"
        Case 12057: tmp = "SEC CERT REV FAILED"
        Case 12152: tmp = "ERROR HTTP INVALID SERVER RESPONSE"
        Case 12157: tmp = "SECURITY CHANNEL ERROR"
        Case 12158: tmp = "UNABLE TO CACHE FILE"
        Case 12159: tmp = "TCPIP NOT INSTALLED"
        Case 12163: tmp = "DISCONNECTED"
        Case 12164: tmp = "SERVER UNREACHABLE"
        Case 12165: tmp = "PROXY SERVER UNREACHABLE"
        Case 12166: tmp = "BAD AUTO PROXY SCRIPT"
        Case 12167: tmp = "UNABLE TO DOWNLOAD SCRIPT"
        Case 12169: tmp = "SEC INVALID CERT"
        Case 12170: tmp = "SEC CERT REVOKED"
        Case Else: tmp = "UNKNOWN RESPONSE CODE"
    End Select: HTTPResponse = tmp
End Function

Function ShortPath(filespec)
    Dim fs, f
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFile(filespec)
        ShortPath = UCase(f.ShortPath)
    Set f = Nothing
    Set fs = Nothing
End Function


Bahamas CCTV . Bahamas DVR . Bahamas Camera . Bahamas IP . Bahamas Video . Bahamas Alarm . Bahamas Software . Bahamas Business . Bahamas Real Estate
Copyright (c) 2001/2010 BahamasSecurity.com