home *** CD-ROM | disk | FTP | other *** search
/ Share Gallery 1 / share_gal_1.zip / share_gal_1 / UT / UT157.ZIP / XDEMO_AD.BAT < prev    next >
DOS Batch File  |  1991-09-06  |  16KB  |  243 lines

  1. echo off
  2. rem  xdemo_ad.bat  -  Demonstrate Advanced "DOS Extensions for Professionals".
  3. rem
  4. rem  
  5. cls
  6. echo ╔═════════════════════════════════════════════════════════════════════════════╗
  7. echo ║                Welcome to "DOS Extensions for Professionals"                ║
  8. echo ║                                                                             ║
  9. echo ║                             An Advanced Demo                                ║
  10. echo ║                                                                             ║
  11. echo ╟─────────────────────────────────────────────────────────────────────────────╢
  12. echo ║                                                                             ║
  13. echo ║ This demo covers more complicated features of some "DOS Extensions for      ║
  14. echo ║ Professionals" programs.                                                    ║
  15. echo ║                                                                             ║
  16. echo ║ Executing this batch file from a hard disk directory containing a copy of   ║
  17. echo ║ the programs and files on the distribution disk will result in              ║
  18. echo ║ significantly faster execution than a floppy-based demo because of the      ║
  19. echo ║ superior performance of your hard drive during disk-intensive operations.   ║
  20. echo ║                                                                             ║
  21. echo ║ For proper operation, the disk this demo executes from must have at least   ║
  22. echo ║ 26,624 bytes free.  If output is missing, check your disk for adequate      ║
  23. echo ║ free space with the DIR or XDIR commands.                                   ║
  24. echo ╚═════════════════════════════════════════════════════════════════════════════╝
  25. pause
  26. cls
  27. echo ╔═════════════════════════════════════════════════════════════════════════════╗
  28. echo ║ You must be running XDEMO_AD from your distribution disk or from a copy of  ║
  29. echo ║ your distribution disk on your hard drive.                                  ║
  30. echo ║                                                                             ║
  31. echo ║ If your current directory is NOT set to the distribution disk or to a copy  ║
  32. echo ║ of the distribution disk on your hard drive,                                ║
  33. echo ║                                                                             ║
  34. echo ║    1.  "<CTRL> C" out of this program,                                      ║
  35. echo ║    2.  change to the drive on which the distribution disk is mounted, and   ║
  36. echo ║    3.  restart this program                                                 ║
  37. echo ║                                                                             ║
  38. echo ║  (for example)                                                              ║
  39. echo ║                Strike a key when ready . . . "<CTRL>C"                      ║
  40. echo ║                Terminate batch job (Y/N)?  y                                ║
  41. echo ║                C: A:                                                        ║
  42. echo ║                A: xdemo                                                     ║
  43. echo ║                                                                             ║
  44. echo ╚═════════════════════════════════════════════════════════════════════════════╝
  45. pause
  46. cls
  47. echo ╔═════════════════════════════════════════════════════════════════════════════╗
  48. echo ║ Making directory TEMP and copying files to it.                              ║
  49. echo ║                                                                             ║
  50. echo ║                                                                             ║
  51. echo ║ The programs demonstrated here are:                                         ║
  52. echo ║      SPLIT   -  split files into parts                                      ║
  53. echo ║      SUB     -  substitute characters in files                              ║
  54. echo ╚═════════════════════════════════════════════════════════════════════════════╝
  55. rem  Free space in case diskette is filled.
  56. rem *** del x.dat >nul
  57. mkdir temp >nul
  58. copy rev22.old temp >nul
  59. pause
  60. cls
  61. echo ╔═════════════════════════════════════════════════════════════════════════════╗
  62. echo ║ Text from the last chapter of the last book of the Bible, the 1611 King     ║
  63. echo ║ James Version, will be used to demonstrate several commands in "DOS         ║
  64. echo ║ Extensions for Professionals".                                              ║
  65. echo ║                                                                             ║
  66. echo ║ QUICKLY refresh your memory as the text scrolls by.  Note that the text is  ║
  67. echo ║ divided into 21 VERSES separated by blank lines.                            ║
  68. echo ║                                                                             ║
  69. echo ║                             "TYPE  REV22.OLD"        (A DOS command.)       ║
  70. echo ╚═════════════════════════════════════════════════════════════════════════════╝
  71. pause
  72. type rev22.old
  73. echo ───────────────────────────────────────────────────────────────────────────────
  74. pause
  75. cls
  76. echo ╔═════════════════════════════════════════════════════════════════════════════╗
  77. echo ║ Change to the \TEMP directory in order to demonstrate commands using write  ║
  78. echo ║ operations.  Use a copy of REV22.OLD as the source.                         ║
  79. echo ║                                                                             ║
  80. echo ║ SPLIT can divide files into "n" pieces, into pieces "n" lines long, at      ║
  81. echo ║ predetermined lines, or at locations marked by user-chosen search strings.  ║
  82. echo ║                                                                             ║
  83. echo ║ The first two examples of SPLITing files at fixed locations were            ║
  84. echo ║ demonstrated in XDEMO.  The more difficult example of SPLITTing a files at  ║
  85. echo ║ contextually-defined locations will be demonstrated here.                   ║
  86. echo ╚═════════════════════════════════════════════════════════════════════════════╝
  87. cd temp
  88. pause
  89. cls
  90. echo ╔═════════════════════════════════════════════════════════════════════════════╗
  91. echo ║ SPLIT rev22.old into 21 files, one for each verse.  To do this, look for a  ║
  92. echo ║ blank line preceding each verse (except the first), and instruct SPLIT to   ║
  93. echo ║ make the break there.                                                       ║
  94. echo ║                                                                             ║
  95. echo ║ Because SPLIT doesn't recognize a simple blank line, pad all lines to       ║
  96. echo ║ column 10 with blanks.  Column 10 is shorter than normal lines which won't  ║
  97. echo ║ be affected.  Blank lines, however, will be lengthened to 10 characters.    ║
  98. echo ║ The search, therefore, can be made on a string of up to 10 blanks.          ║
  99. echo ║                                                                             ║
  100. echo ║ Review the Built-in Help for SUB /PAD                                       ║
  101. echo ║                                                                             ║
  102. echo ║     SUB  -HELP  /PAD                                                        ║
  103. echo ╚═════════════════════════════════════════════════════════════════════════════╝
  104. pause
  105. cls
  106. ..\sub -help /pad
  107. echo ╔═════════════════════════════════════════════════════════════════════════════╗
  108. echo ║ Use SUB to pad the lines of REV22.OLD out to 10 characters.                 ║
  109. echo ║                                                                             ║
  110. echo ║                           SUB  REV22.OLD  /PAD=10                           ║
  111. echo ╚═════════════════════════════════════════════════════════════════════════════╝
  112. rem  Save disk space with /nobak
  113. ..\sub rev22.old /pad=10  /nobak
  114. echo ───────────────────────────────────────────────────────────────────────────────
  115. pause
  116. cls
  117. echo ╔═════════════════════════════════════════════════════════════════════════════╗
  118. echo ║ Now SPLIT REV22.OLD before lines where there are 7 blanks.                  ║
  119. echo ║                                                                             ║
  120. echo ║                        SPLIT  REV22.OLD  /BEFORE="       "                  ║
  121. echo ╚═════════════════════════════════════════════════════════════════════════════╝
  122. ..\split rev22.old /before="       "
  123. ..\xdir rev22
  124. echo ───────────────────────────────────────────────────────────────────────────────
  125. pause
  126. cls
  127. echo ╔═════════════════════════════════════════════════════════════════════════════╗
  128. echo ║ Using the DOS TYPE command, output several files to see if their verse      ║
  129. echo ║ numbers match their file extension number.  There are 21 verses.  There are ║
  130. echo ║ 21 files.  They should correspond perfectly.                                ║
  131. echo ╚═════════════════════════════════════════════════════════════════════════════╝
  132. echo on
  133. type rev22.003
  134. type rev22.016
  135. echo off
  136. echo ───────────────────────────────────────────────────────────────────────────────
  137. del rev22.* >nul
  138. pause
  139. cls
  140. echo ╔═════════════════════════════════════════════════════════════════════════════╗
  141. echo ║ Demonstrate SUB by creating a batch file which processes each non-directory ║
  142. echo ║ file found in the root directory against a ficticious CONVERT program       ║
  143. echo ║ which requires as output the original file name with the extension ".TRS".  ║
  144. echo ║ Each line should have the form                                              ║
  145. echo ║                                                                             ║
  146. echo ║                       CONVERT  file.ext  file.TRS                           ║
  147. echo ║                                                                             ║
  148. echo ║ Use XDIR to create the base file.                                           ║
  149. echo ║                                                                             ║
  150. echo ║    "XDIR  ..  /NODIRECTORIES  /COLUMN=1  /NOHEADING  /NOFOOT  >  X.BAT"     ║
  151. echo ╚═════════════════════════════════════════════════════════════════════════════╝
  152. ..\xdir ../nodirectories/column=1/noheading/nofoot > x.bat
  153. pause
  154. cls
  155. echo ╔═════════════════════════════════════════════════════════════════════════════╗
  156. echo ║ Initially X.BAT looks like this.                                            ║
  157. echo ╚═════════════════════════════════════════════════════════════════════════════╝
  158. type x.bat
  159. echo ───────────────────────────────────────────────────────────────────────────────
  160. pause
  161. cls
  162. echo ╔═════════════════════════════════════════════════════════════════════════════╗
  163. echo ║ Use SUB to copy the file name to column 15.  File names, remember, can be   ║
  164. echo ║ of differing lengths but occupy at most columns 1 through 12.               ║
  165. echo ║                                                                             ║
  166. echo ║                           SUB  X.BAT  /COPY=1,12  /AT=15                    ║
  167. echo ╚═════════════════════════════════════════════════════════════════════════════╝
  168. ..\sub x.bat /copy=1,12/at=15 >nul
  169. type x.bat
  170. echo ───────────────────────────────────────────────────────────────────────────────
  171. pause
  172. cls
  173. echo ╔═════════════════════════════════════════════════════════════════════════════╗
  174. echo ║ Search for the extension in the second file name and replace it with ".TRS".║
  175. echo ║                                                                             ║
  176. echo ║ The second file name's extension begins with "." and is located somewhere   ║
  177. echo ║ in columns 15 through 27.  The extension is at most 4 characters long and   ║
  178. echo ║ must be replaced with the extension ".TRS"                                  ║
  179. echo ║                                                                             ║
  180. echo ║ The "/FOR=" Command Modifier is the anchor for both /DELETE and /INSERT.    ║
  181. echo ║ In this case, /FOR is constrained to look for its target text (".") in      ║
  182. echo ║ the range limited by /FROM=15,27.  If "." is not found in that range, no    ║
  183. echo ║ substitution is made in that line.                                          ║
  184. echo ║                                                                             ║
  185. echo ║         SUB  X.BAT  /FROM=15,27  /FOR="."  /DELETE=4  /INSERT=".TRS"        ║
  186. echo ╚═════════════════════════════════════════════════════════════════════════════╝
  187. ..\sub x.bat /from=15,27/for="."/delete=4/insert=".TRS" >nul
  188. pause
  189. cls
  190. echo ╔═════════════════════════════════════════════════════════════════════════════╗
  191. echo ║         SUB  X.BAT  /FROM=15,27  /FOR="."  /DELETE=4  /INSERT=".TRS"        ║
  192. echo ╚═════════════════════════════════════════════════════════════════════════════╝
  193. type x.bat
  194. echo ───────────────────────────────────────────────────────────────────────────────
  195. pause
  196. cls
  197. echo ╔═════════════════════════════════════════════════════════════════════════════╗
  198. echo ║ Finally, insert "CONVERT " at each line's beginning.                        ║
  199. echo ║                                                                             ║
  200. echo ║                       SUB  X.BAT  /INSERT="CONVERT "                        ║
  201. echo ╚═════════════════════════════════════════════════════════════════════════════╝
  202. ..\sub x.bat /insert="CONVERT " >nul
  203. type x.bat
  204. echo ───────────────────────────────────────────────────────────────────────────────
  205. pause
  206. cls
  207. echo ╔═════════════════════════════════════════════════════════════════════════════╗
  208. echo ║ This somewhat contrieved example illustrates the power of SUB.  Calls this  ║
  209. echo ║ complicated would, in practice, themselves be put into a batch file  -  a   ║
  210. echo ║ batch file to create other batch files.                                     ║
  211. echo ╚═════════════════════════════════════════════════════════════════════════════╝
  212. cd ..
  213. del temp\x.*
  214. rd temp
  215. rem *** copy /b split.exe+search.exe x.dat >nul
  216. echo off
  217. rem  xdemo_as.bat  -  This portion of the xdemo_ad program is inserted as a
  218. rem                   reminder into the shareware version.
  219. pause
  220. cls
  221. echo ╔═════════════════════════════════════════════════════════════════════════════╗
  222. echo ║                                                                             ║
  223. echo ║ This is the Shareware Version of "DOS Extensions for Professionals".        ║
  224. echo ║                                                                             ║
  225. echo ║ You are licensed to use this software for an evaluation period of THREE     ║
  226. echo ║ WEEKS.  After this period, you must either remove all copies of this        ║
  227. echo ║ software from your computer system and refrain from all additional use,     ║
  228. echo ║ or register your copy with                                                  ║
  229. echo ║                                                                             ║
  230. echo ║                          Allison Software                                   ║
  231. echo ║                           166 Shady Lane                                    ║
  232. echo ║                          Apollo, PA  15613                                  ║
  233. echo ║                                USA                                          ║
  234. echo ║                                                                             ║
  235. echo ║ When you register, you'll receive the latest Retail Version of "DOS         ║
  236. echo ║ Extensions for Professionals", a printed instruction manual, and mail and   ║
  237. echo ║ telephone product support as needed.                                        ║
  238. echo ║                                                                             ║
  239. echo ║ Registration instructions are in the file REGISTER.DOC on the distribution  ║
  240. echo ║ disk.                                                                       ║
  241. echo ║                                                                             ║
  242. echo ╚═════════════════════════════════════════════════════════════════════════════╝
  243.