home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 16 / 16.iso / t / t272 / 1.img / TMESDEMO.EXE / TMESDEM1.BAT < prev    next >
Encoding:
DOS Batch File  |  1993-11-01  |  13.0 KB  |  372 lines

  1. echo off
  2. CLS
  3. Echo              This is a DEMO for TMES -- The Master Environment SET
  4. Echo              The program TMES.EXE is copyrighted 1993 by Tee Roper
  5. Echo              =====================================================
  6. Echo.
  7. Echo           This Batch file was created so you can see how to use TMES
  8. Echo           by just enjoying the DEMO "show."  I hope you like what you see.
  9. Echo.
  10. Echo           TMES adds versatility to the area of your PC that you don't
  11. ECHO           normally use for much, the Environment Area.  This utility
  12. Echo           may change your ideas about its use.
  13. Echo.
  14. Echo           Enjoy this TMES DEMO.   Tee
  15. Echo.
  16. Echo.
  17. Echo.
  18. Echo.
  19. Echo.
  20. Echo.
  21. Echo.
  22. Echo.
  23. pause
  24. CLS
  25. Echo.
  26. Echo ---- Before we start, let me test your Environment space to see -----
  27. Echo ------------ if you have enough room to run the DEMO ----------------
  28. Echo.
  29. Echo I will test your environment for its size.
  30. Echo I'll be using TMES to check it, too.
  31. Echo - so here goes -
  32. Echo TMES BYTLF /ELEFT
  33. TMES BYTLF /ELEFT
  34. Echo (it just ran)
  35. Echo this one line above sets the variable BYTLF to the number of BYTes LeFt in your
  36. Echo environment space which you have now.  Remember the Variable name "BYTLF".
  37. Echo Now I will see how large it really is....wait a second while I do some math!
  38. Echo TMES SIZE /ESIZE
  39. TMES SIZE /ESIZE
  40. Echo TMES X %%BYTLF%%
  41. TMES X %BYTLF%
  42. ECHO TMES X /mul 100  (we're doing Integer Math here, so, X times 100)
  43. TMES X /mul 100
  44. Echo TMES X /div %%SIZE%%
  45. TMES X /DIV %SIZE%
  46. Echo Whew!
  47. Echo (if you're running this DEMO on a floppy disk, it's slow, I'm sorry!)
  48. Echo.
  49. Echo Your Environment will hold %SIZE% bytes,... so your space is %X% %% occupied.
  50. Echo.
  51. Pause
  52. CLS
  53. Echo.
  54. Echo You have %BYTLF% bytes REMAINING in your Environment space (%%BYTLF%%).
  55. Echo.
  56. Echo Most people, today, have increased their Environment size.
  57. Echo.
  58. Echo TMES may make you re-think how big you want it now.  You can
  59. Echo do it in your CONFIG.SYS file in just one line.  For example,
  60. Echo I run DOS version 5.0 and my CONFIG.SYS has this line in it:
  61. Echo.
  62. Echo            SHELL C:\COMMAND.COM C:\ /E:800 /P /F
  63. Echo.
  64. Pause
  65. CLS
  66. Echo.
  67. Echo SHELL C:\COMMAND.COM C:\ /E:800 /P /F
  68. Echo (It's the /E:800 part which sets the Environment space)
  69. Echo.
  70. Echo Check your own version of DOS to see how to do it on/in YOUR VERSION.
  71. Echo In my example above, I have 800 bytes allocated for my environment.
  72. Echo.
  73. Echo TMES BYTLF /LT 100 ANS
  74. Echo (asks if the variable "BYTLF" is less than 100, result goes into ANS)
  75. TMES BYTLF /LT 100 ANS
  76. :: the logical 0 or 1 goes into the ANS variable
  77. ::
  78. Echo.
  79. Echo I know that you have exactly %BYTLF% bytes left....
  80. if '%ANS%'=='1' Echo ....and so, watch this DEMO carefully, since you don't have much Environment
  81. if '%ANS%'=='1' Echo     Space left.  I need about 50 bytes from time to time.
  82. if '%ANS%'=='0' Echo ...and so, great!, since you have more than 100 bytes of Environment left.
  83. Echo.
  84. pause
  85. CLS
  86. ::
  87. tmes /del ANS BYTLF X SIZE
  88. ::****delete some************
  89. ::
  90. Echo.
  91. Echo TMES will run many times during this DEMO to SET your Environment.
  92. Echo If your Environment area were set up to hold 2000 bytes, it could
  93. Echo be more useful than a 2K TSR I'll bet.  Think about it, please.
  94. Echo.
  95. Echo This DEMO will let you can see what TMES can do without having to dream up any
  96. Echo functions to test TMES yourself.  I hope this DEMO will give you some
  97. Echo fresh ideas of how you could use TMES at Work....or at Home.
  98. Echo.
  99. Echo Here goes.......
  100. Echo.
  101. Pause
  102. CLS
  103. Echo.
  104. Echo This is the part of your current Environment which TMES operates within.
  105. Echo It is seen by issuing the normal DOS "SET" command - so, here goes...
  106. Echo ----------------------------------------------------------
  107. SET
  108. Echo ----------------------------------------------------------
  109. Pause
  110. CLS
  111. Echo.
  112. Echo Now TMES will set two variables:  JJ and DD
  113. Echo DD will become the current Drive you're using here, and
  114. Echo the variable JJ will become free space left on the disk in the drive.
  115. Echo %%DD%% will be the Drive letter used, and %%JJ%% will be the free
  116. Echo space left on that drive in bytes.  Any Ideas about Copying files?
  117. Echo.
  118. Echo Be sure to look at this Batch file after this DEMO is over.
  119. Echo.
  120. Echo I will now use TMES to set DD to the current drive, like A: or C:
  121. ECHO TMES DD /DRV
  122. TMES DD /DRV
  123. Echo (it's done...)
  124. Echo and now I will use TMES again to set JJ equal to the number of bytes
  125. Echo   which are free (unused as yet) on this same Drive %DD%: of yours.
  126. ECHO TMES JJ /FREE
  127. TMES JJ /FREE
  128. Echo (it's done...)
  129. Echo Notice above that I now know what drive you're running this on, %DD%:
  130. Echo.
  131. pause
  132. CLS
  133. Echo.
  134. Echo Now, using the variables JJ and DD in the next line, I know that:
  135. Echo You have %JJ% bytes free on %DD%: - that fact could be useful to know.
  136. Echo.
  137. Echo These two functions, ie /FREE and /DRV could be used to decide
  138. Echo whether or not you have enough room on a diskette to do a copy
  139. Echo or a back up, for instance.  If you didn't have enough room, you
  140. Echo could tell the user to insert another diskette.  It's a new game now
  141. Echo with TMES at your side.  Write your own Utilities.  Customize easily.
  142. Echo.
  143. Echo Let's learn how to use a couple more of the forty (40) switches
  144. Echo   available for you.  Let's use /YEAR4 and then /LE after that.
  145. Echo The /YEAR4 switch will get the current Year in four digits, and
  146. Echo   then the /LE will use boolean logic to test whether the year is less
  147. Echo   than or equal to 1994.  It looks at your system date, FYI.
  148. Echo.
  149. Echo TMES gives you a new programming ability in your Environment Area!
  150. Echo.
  151. Echo Deleting the variables JJ and DD since we won't use them again.
  152. Echo TMES /del JJ DD
  153. tmes /del JJ DD
  154. ::***delete some**********
  155. ::
  156. Echo.
  157. PAUSE
  158. CLS
  159. Echo.
  160. Echo Here goes...let's get the Year and then test it!
  161. Echo.
  162. Echo TMES YR /YEAR4
  163. TMES YR /YEAR4
  164. Echo TMES YR /LE 1994 X
  165. TMES YR /LE 1994 X
  166. Echo TMES was just run twice...
  167. Echo.
  168. Echo I have %YR% for the Year and a one (1), or zero (0), for the result
  169. Echo of testing %YR% against the number 1994.  If the date is Less Than
  170. Echo or Equal to the year 1994, then this number will be a 1.
  171. Echo.
  172. Echo If you run this DEMO in the year 1995 or afterwards, then the result will
  173. Echo be a zero.
  174. Echo.
  175. Echo Here's the result: it's a %X%....
  176. Echo.
  177. Pause
  178. CLS
  179. Echo.
  180. Echo So, we can write a small amount of "IF" code like we do in Assembly
  181. Echo  or Basic or Pascal or whatever language you know.....
  182. if '%X%'=='1' goto no
  183. Echo The current year %YR% is Greater than 1994.  Where did you get this?
  184. Echo ---------------------- Get a "Fresher" Copy ------------------------
  185. Echo There are a lot of TMES versions you have missed.  TMES was first
  186. Echo created in the year 1993.  There's no time bomb, however, so enjoy!
  187. Echo Tee Roper, author
  188. Echo.
  189. goto ennd
  190. ::
  191. :no
  192. Echo The Current year "%YR%" -----is either "1993" or "1994", and
  193. Echo so, you have a relatively fresh copy of TMES.  Enjoy its use in your
  194. Echo system.  Write me with new ideas for future versions.  Thanks.
  195. Echo Tee Roper, author
  196. Echo.
  197. :ennd
  198. Pause
  199. CLS
  200. Echo.
  201. ::
  202. Echo Deleting a couple of variables.
  203. ECHO TMES /del ANS X
  204. tmes /del ANS X
  205. ::****delete some************
  206. ::
  207. :topofinput
  208. Echo.
  209. Echo Now, Please Enter Your Name, using Normal UPPER and lower case letters
  210. TMES NAME /INPUT
  211. if '%NAME%'=='' Echo Come on, you didn't enter a name... I watched you.
  212. if '%NAME%'=='' goto topofinput
  213. Echo.
  214. Echo Getting the Day of Week, the Month's number, and the Day of the month
  215. Echo.
  216. Echo TMES WEEKDAY /DOW
  217. TMES WEEKDAY /DOW
  218. ::
  219. Echo TMES MONF /MONTH
  220. TMES MONF /MONTH
  221. ::
  222. Echo TMES DY /DOM
  223. TMES DY /DOM
  224. Echo.
  225. Echo (TMES was just run 3 times, %NAME%.)
  226. Echo.
  227. Pause
  228. CLS
  229. Echo.
  230. Echo Thanks, %NAME%, for trying TMES today which is #%DY% on a
  231. if '%WEEKDAY%'=='0' Echo Sunday in the Month #%MONF% of the Year %YR%.
  232. if '%WEEKDAY%'=='1' Echo Monday in the Month #%MONF% of the Year %YR%.
  233. if '%WEEKDAY%'=='2' Echo Tuesday in the Month #%MONF% of the Year %YR%.
  234. if '%WEEKDAY%'=='3' Echo Wednesday in the Month #%MONF% of the Year %YR%.
  235. if '%WEEKDAY%'=='4' Echo Thursday in the Month #%MONF% of the Year %YR%.
  236. if '%WEEKDAY%'=='5' Echo Friday in the Month #%MONF% of the Year %YR%.
  237. if '%WEEKDAY%'=='6' Echo Saturday in the Month #%MONF% of the Year %YR%.
  238. Echo There's more Date type functions.  We'll use one more, so
  239. Pause
  240. CLS
  241. Echo.
  242. Echo TMES /del MONF NAME WEEKDAY YR DY    (deleting some variables just used)
  243. TMES /del MONF NAME WEEKDAY YR DY
  244. ::*********delete some************
  245. Echo.
  246. Echo TMES THEDATE /DATE
  247. TMES THEDATE /DATE
  248. Echo I just Ran TMES to get the whole date at one time.  That's easier than
  249. Echo putting together the three pieces, Year, Month, and Day.
  250. Echo.
  251. Echo /DATE produced a variable THEDATE which, today, is %THEDATE%.
  252. Echo.
  253. Echo I could write ONE batch file that backed up my data every day - and -
  254. Echo gave each file a new name made from the date on which it was run!
  255. Echo.
  256. Echo Let's use the /INPUT switch to get the name of the filespec to copy.
  257. Echo so, we would do this:
  258. Echo TMES FILEIN /INPUT
  259. Echo.
  260. Pause
  261. CLS
  262. Echo.
  263. Echo I'm doing it now as a "fake" input to make FILEIN = FILESPEC in this
  264. Echo DEMO program so you won't have to Input anything.
  265. Echo.
  266. Echo TMES FILEIN C:\UTIL\ALLNAMES.DBF
  267. TMES FILEIN C:\UTIL\ALLNAMES.DBF
  268. Echo.
  269. Echo I could have used DOS' SET to do this, as well, by typimg this:
  270. Echo SET FILEIN=C:\UTIL\ALLNAMES.DBF
  271. Echo.
  272. ::
  273. :: You can forget about SET if you have TMES.
  274. ::
  275. Echo Parsing what was input and using Z for a variable.
  276. Echo "Z" could be any other variable you want to use, but use Z now.
  277. Echo.
  278. Echo I will parse C:\UTIL\ALLNAMES.DBF for you in the next line.
  279. Echo.
  280. Echo TMES Z /PARSE C:\UTIL\ALLNAMES.DBF
  281. TMES Z /PARSE C:\UTIL\ALLNAMES.DBF
  282. :: the above line really works (using Z) so you can see the results below
  283. ::
  284. Echo.
  285. Pause
  286. CLS
  287. Echo.
  288. Echo We did a "TMES Z /PARSE C:\UTIL\ALLNAMES.DBF"
  289. Echo.
  290. Echo And each part of FILEIN is assigned to "ZD" or "ZP" or "ZN" or "ZE" !!!!
  291. Echo.
  292. Echo So, let's suppose we entered C:\UTIL\ALLNAMES.DBF (the one faked as INPUT!)
  293. Echo For instance, the above filespec would be broken down (parsed) by TMES
  294. Echo to yield ZD, ZP, ZN, and ZE which are the parts of the
  295. Echo The filespec we are working with, which is %FILEIN%
  296. Echo  ZD is the Drive or %ZD% in this example.
  297. Echo  ZP is the Path or %ZP%.
  298. Echo  ZN is the Name of the file which is %ZN%, and finally,
  299. Echo  ZE is the Extension which is %ZE% here.
  300. Echo  ...Remember that No colons or periods are saved.
  301. Echo You can always add colons or periods later, if needed.  It's cleaner.
  302. Echo.
  303. Pause
  304. CLS
  305. Echo.
  306. Echo Then I can put the 4 filespec "parts"  back together using the double percents
  307. Echo like this: %ZD%:%ZP%\%ZN%.%ZE% made from this: %%ZD%%:%%ZP%%\%%ZN%%.%%ZE%%
  308. Echo so just look at this in this TMESDEMO.BAT file and you'll see that I
  309. Echo used the real variables here, not just names typed in.
  310. Echo.
  311. Pause
  312. CLS
  313. Echo.
  314. Echo And now, let's use these parts to make a Serialized Date Copy:
  315. Echo Here's what you would type into your "copy genius" BATCH file:
  316. Echo TMES FILEIN  /input            (you would input a filespec here to backup)
  317. Echo TMES THEDATE /date
  318. Echo TMES Z  /parse  %%FILEIN%%
  319. Echo :
  320. Echo COPY  %%FILEIN%%   %%ZD%%:%%ZP%%\BK%%THEDATE%%.%%ZE%%
  321. Echo :
  322. Echo : which is equivalent to writing the following line for today:
  323. Echo : COPY %FILEIN%  %ZD%:%ZP%\BK%THEDATE%.%ZE%
  324. Echo.
  325. Echo When you run this same TMESDEMO.BAT tomorrow, the %%THEDATE%% below will change!
  326. Echo The system date creates this string variable: %THEDATE% for today!
  327. Echo.
  328. ::       notice the addition of the colons and slashes and dots as needed!
  329. ::       TMES assumes you would rather have "clean" variables to work with!
  330. ::-------
  331. Echo You would have a "Date Oriented" and "Serialized" file in the same place
  332. Echo on your harddrive.  On each day you ran it, the FileCopyName would change! 
  333. Echo.
  334. pause
  335. CLS
  336. Echo Here is your environment again.  See the new TMES Variables?
  337. SET
  338. Pause
  339. CLS
  340. Echo.
  341. Echo and now I will erase the remaining TMES Variables with one line of code.
  342. Echo .....Just by doing "TMES /del FILEIN ZD ZN ZP ZE THEDATE"
  343. Echo.
  344. Echo Important:
  345. Echo Stop now with "Control-C" if you want to stop the Batch file from
  346. Echo     deleting the TMES variables, ....else let's get rid of them.
  347. Echo.
  348. Pause
  349. CLS
  350. Echo.
  351. Echo TMES /del FILEIN ZD ZN ZP ZE THEDATE ANS
  352. TMES /del FILEIN ZD ZN ZP ZE THEDATE ANS
  353. ::***********delete a bunch*******************
  354. ::
  355. Echo (done, the TMESDEMO %%VARIABLES%% that we had created are gone now)
  356. Echo Here's your old "original" environment back.
  357. Echo ----------------------------------------------------------
  358. SET
  359. Echo ----------------------------------------------------------
  360. Pause
  361. CLS
  362. Echo.
  363. Echo That concludes the TMES DEMO batch file.
  364. Echo.
  365. Echo I hope you can find TMES useful enough to add to your DOS
  366. Echo subdirectory in your home and especially at work - hint, hint.
  367. Echo.
  368. Echo "Registration Thanks" from me and from my family.  Tee Roper
  369. ::
  370. :: Please do not change this Batch file if you give it to others.  Thanks. Tee
  371. 
  372.