home *** CD-ROM | disk | FTP | other *** search
/ terabyteunlimited.com / 2014.06.terabyteunlimited.com.tar / terabyteunlimited.com / ifdsetup.zip / setupifd.bat < prev   
DOS Batch File  |  2012-02-19  |  6KB  |  213 lines

  1. @echo off
  2.  
  3. :: SETUPIFD.BAT
  4. :: version 1.1
  5. :: -------------
  6.  
  7. ::
  8. :: TargetDir must be set to a drive letter located on boot drive (HD0)
  9. ::
  10. set TARGETDIR=C:\TBOS
  11.  
  12. ::
  13. :: IFDDIR is where the Image for DOS files can be found
  14. :: If not set, the default installation path will be used.
  15. ::
  16. set IFDDIR=
  17.  
  18. ::
  19. :: IFDPK is your Image for DOS or BootIt BM Product Key (used if no existing 
  20. :: ifd.ini or bootitbm.ini file found)
  21. ::
  22. set IFDPK=XXXX-XXXX-XXXX
  23.  
  24. ::
  25. :: IFDLN is your BootIt BM Licensed Name (used if no existing ifd.ini or
  26. :: bootitbm.ini file found and you are using your BootIt BM Product Key)
  27. :: Leave IFDLN blank if using your Image for DOS product key
  28. ::
  29. set IFDLN=
  30.  
  31. ::
  32. :: IFDCMD is the Image for DOS command line to use.  
  33. ::
  34. ::    +=====================================================================+
  35. ::    + Note that a DOS program can only receive the first 126 characters   +
  36. ::    + of the command line parameters provided to it.  This limit includes +
  37. ::    + the space between the program name and parameters.  All characters  +
  38. ::    + beyond the 126th are truncated by DOS. This means you need to use   +
  39. ::    + short file paths and/or short file names to ensure the command      +
  40. ::    + operates as expected                                                +
  41. ::    +=====================================================================+
  42. ::
  43. set IFDCMD=image.exe /log:0
  44.  
  45. ::
  46. :: IFDBIN is the IFD container name to use (without the extension)
  47. ::
  48. set IFDBIN=ifd
  49.  
  50. ::-----------------------------------------------------------------------------
  51. ::-----------------------------------------------------------------------------
  52.  
  53. ::
  54. :: Setup name of windows version of TBOSDT (to support older releases)
  55. ::
  56. set TBOSDT=tbosdtw.exe
  57. if not exist ..\win\%TBOSDT% set TBOSDT=tbosdt.exe
  58.  
  59. ::
  60. :: Set default IFD files path, if necessary
  61. ::
  62. if "%ifddir:~0,1%"==" " set IFDDIR=
  63. if "%ifddir%"=="" if "%PROCESSOR_ARCHITECTURE%"=="AMD64" set IFDDIR=C:\Program Files (x86)\TeraByte Unlimited\Image for Windows\V2\IFD
  64. if "%ifddir%"=="" set IFDDIR=C:\Program Files\TeraByte Unlimited\Image for Windows\V2\IFD
  65.  
  66. ::
  67. :: verify directory and files
  68. ::
  69. for %%i in (setupifd.bat bootfile.exe ..\win\tbossys.exe ..\win\bootfile.exe ..\win\%TBOSDT%) do if not exist %%i goto baddir
  70. for %%i in ("%ifddir%\image.exe" "%ifddir%\cdboot.f35" "%ifddir%\cdboot.ins") do if not exist %%i goto badifddir
  71.  
  72. ::
  73. :: create the new virtual drive file
  74. ::
  75. if exist "%ifdbin%.bin" del "%ifdbin%.bin" >nul
  76. echo add virtdrv "%ifdbin%.bin" 2 TBOS /b > crtvdrv.run
  77. ..\win\%TBOSDT% crtvdrv.run
  78. if errorlevel 1 goto badvcrt
  79.  
  80. ::
  81. :: Setup the check files debug script
  82. ::
  83. echo set textline chkfiles.txt "Boot file: %ifdbin%.bin" > chkfiles.run
  84. echo set textline chkfiles.txt " " >> chkfiles.run
  85. echo type chkfiles.txt >> chkfiles.run
  86. echo del chkfiles.txt /q >> chkfiles.run
  87. echo mount 0: "%ifdbin%.bin" >> chkfiles.run
  88. echo dir 0: >> chkfiles.run
  89. echo umount 0: >> chkfiles.run
  90.  
  91. ::
  92. :: Create cdboot.f35 extraction script
  93. ::
  94. echo mount 0: "%ifddir%\cdboot.f35" >extractcdboot.run
  95. echo copy 0:\ifd.dat ifdfiles\ifd.dat >>extractcdboot.run
  96. echo copy 0:\mouse.com ifdfiles\mouse.com >>extractcdboot.run
  97. echo umount 0: >>extractcdboot.run
  98.  
  99. ::
  100. :: sys the virtual drive and copy in the files
  101. ::
  102. md ifdfiles > nul
  103. copy "%ifddir%\image.exe" ifdfiles >nul
  104. copy "%ifddir%\cdboot.ins" ifdfiles >nul
  105. copy "%ifddir%\cdboot.f35" ifdfiles >nul
  106.  
  107. :: extract files from cdboot.f35 (ifd.dat & mouse.com -- GUI ver)
  108. ..\win\%TBOSDT% extractcdboot.run >nul
  109.  
  110. :: copy INI file
  111. if exist ifd.ini copy ifd.ini ifdfiles >nul
  112. if exist ifdfiles\ifd.ini goto dosys
  113. if exist bootitbm.ini copy bootitbm.ini ifdfiles\ifd.ini >nul
  114. if exist ifdfiles\ifd.ini goto dosys
  115. if exist "%ifddir%\ifd.ini" copy "%ifddir%\ifd.ini" ifdfiles >nul
  116. if exist ifdfiles\ifd.ini goto dosys
  117. if exist "%ifddir%\bootitbm.ini" copy "%ifddir%\bootitbm.ini" ifdfiles\ifd.ini >nul
  118. if exist ifdfiles\ifd.ini goto dosys
  119. echo [RESTORE_DEFAULTS] > ifdfiles\ifd.ini
  120. echo SaveLog=0 >> ifdfiles\ifd.ini
  121. echo [License] >> ifdfiles\ifd.ini
  122. echo ProductKey=%IFDPK% >> ifdfiles\ifd.ini
  123. if not "%IFDLN%"=="" echo User=%IFDLN% >> ifdfiles\ifd.ini
  124. if exist ifdfiles\ifd.dat echo [Video] >> ifdfiles\ifd.ini
  125. if exist ifdfiles\ifd.dat echo Method=1 >> ifdfiles\ifd.ini
  126. if exist ifdfiles\ifd.dat echo Mode=36 >> ifdfiles\ifd.ini
  127.  
  128. :dosys
  129. ::
  130. :: create the tbos.str file & create boot file
  131. ::
  132. echo bootfile.exe /restore > tbos.str
  133. if exist ifdfiles\mouse.com echo MOUSE.COM >> tbos.str
  134. echo %IFDCMD% >> tbos.str
  135. echo bootfile.exe /reboot >> tbos.str
  136.  
  137. set IFDINI=
  138. if exist ifdfiles\ifd.ini set IFDINI=ifdfiles\ifd.ini
  139. set IFDDAT=
  140. if exist ifdfiles\ifd.dat set IFDDAT=ifdfiles\ifd.dat
  141. set IFDMOUSE=
  142. if exist ifdfiles\mouse.com set IFDMOUSE=ifdfiles\mouse.com
  143. ..\win\tbossys /f "%ifdbin%.bin" bootfile.exe tbos.str ifdfiles\image.exe ifdfiles\cdboot.ins ifdfiles\cdboot.f35 %IFDINI% %IFDDAT% %IFDMOUSE%
  144. if errorlevel 1 goto badsys
  145.  
  146. ::
  147. :: setup target directory
  148. ::
  149. if exist %targetdir%\. goto skipmd
  150. md %targetdir% > nul
  151. if not exist %targetdir%\. goto badmd
  152. :skipmd
  153. copy "%ifdbin%.bin" %targetdir% >nul
  154. copy ..\win\bootfile.exe %targetdir% >nul
  155. echo %targetdir%\bootfile "%targetdir%\%ifdbin%.bin" > "%targetdir%\run_%ifdbin%.bat"
  156. start %targetdir%
  157. goto end
  158.  
  159. ::
  160. :: report errors
  161. ::
  162. :badmd
  163. echo Unable to create target directory %targetdir%
  164. pause
  165. goto end
  166.  
  167. :badvcrt
  168. echo Error Creating Virtual Partition
  169. pause
  170. goto end
  171.  
  172. :badsys
  173. echo Error During Setup of Virtual Partition
  174. pause
  175. goto end
  176.  
  177. :baddir
  178. echo This batch file must be launched from the tbos_dos folder.
  179. pause
  180. goto end
  181.  
  182. :badifddir
  183. echo Unable to find the required Image for DOS files. 
  184. echo Please check the IFDDIR variable.
  185. pause
  186. goto end
  187.  
  188. :end
  189. :
  190. : remove files and folders created
  191. :
  192. if exist crtvdrv.run del crtvdrv.run
  193. if exist tbos.str del tbos.str >nul
  194. if not exist ifdfiles\. goto nord
  195. del ifdfiles\image.exe >nul
  196. del ifdfiles\ifd.ini >nul
  197. del ifdfiles\cdboot.ins >nul
  198. del ifdfiles\cdboot.f35 >nul
  199. if exist ifdfiles\ifd.dat del ifdfiles\ifd.dat >nul
  200. if exist ifdfiles\mouse.com del ifdfiles\mouse.com >nul
  201. del extractcdboot.run >nul
  202. rd ifdfiles >nul
  203. :nord
  204.  
  205. set IFDINI=
  206. set IFDDAT=
  207. set IFDMOUSE=
  208. set IFDPK=
  209. set IFDLN=
  210. set IFDDIR=
  211. set TARGETDIR=
  212. set TBOSDT=
  213.