home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / b / butl.zip / BATMAKR2.BAS < prev    next >
BASIC Source File  |  1993-03-01  |  2KB  |  71 lines

  1. 100 'BATMAKR2.BAS -- by Paul Somerson
  2. 110 ' (c) 1987 Ziff Communications Co.
  3. 120 'This creates easy subdirectory switcher files
  4. 130 ' (And puts them all in one very long file.)
  5. 140 'Before you use this, get into DOS and type:
  6. 150 '
  7. 160 '    CHKDSK / V | FIND "Dir" > TEMPFILE
  8. 170 '
  9. 180 'For this to work properly, make sure each
  10. 190 '    subdirectory has its own unique name.
  11. 200 'To switch between subdirectories in DOS, type
  12. 210 '    S and then the name of the subdirectory
  13. 220 '    WITHOUT the "CD\" prefix, and WITHOUT the
  14. 230 '    long PATHname that usually precedes it.
  15. 240 'For instance, to switch to \DOS\BIN, type:
  16. 250 '    S BIN
  17. 260 'DON'T run S.BAT on a floppy disk.  For best
  18. 270 '    results, run it on a RAMdisk you've PATHed to.
  19. 280 '
  20. 290 DIM B$(300),C$(300),F$(300)
  21. 300 ON ERROR GOTO 790
  22. 310 '
  23. 320 ' --- read raw file, truncate left end of each line ---
  24. 330 '
  25. 340 OPEN "tempfile" FOR INPUT AS #1
  26. 350 IF EOF(1) THEN 500 ELSE LINE INPUT #1,A$
  27. 360 B$(K)=RIGHT$(A$,LEN(A$)-10):IF B$(K)="\" THEN 350
  28. 370 FOR A=LEN(B$(K)) TO 1 STEP -1
  29. 380 IF MID$(B$(K),A,1)="\" THEN C$(K)=RIGHT$(B$(K),LEN(B$(K))-A):GOTO 430
  30. 390 NEXT
  31. 400 '
  32. 410 ' --- create lowercase version of each test ---
  33. 420 '
  34. 430 FOR D=1 TO LEN(C$(K))
  35. 440 F$(K)=F$(K)+CHR$(ASC(MID$(C$(K),D,1)) OR 32)
  36. 450 NEXT
  37. 460 K=K+1:GOTO 350
  38. 470 '
  39. 480 ' --- write upper- and lowercase tests to S.BAT ---
  40. 490 '
  41. 500 OPEN "S.BAT" FOR OUTPUT AS #2
  42. 510 PRINT #2,"ECHO OFF"
  43. 520 PRINT #2,"IF %1@==@ GOTO ERROR2"
  44. 530 FOR A=1 TO K-1
  45. 540 PRINT #2,"IF %1==";C$(A);" goto ";C$(A)
  46. 550 PRINT #2,"IF %1==";F$(A);" goto ";C$(A)
  47. 560 NEXT
  48. 570 PRINT #2,"GOTO ERROR1"
  49. 580 '
  50. 590 ' --- write actual CD instructions to S.BAT ---
  51. 600 '
  52. 610 FOR A=1 TO K-1
  53. 620 PRINT #2,":"+C$(A)
  54. 630 PRINT #2,"CD"+CHR$(32)+B$(A)
  55. 640 PRINT #2,"GOTO END"
  56. 650 NEXT 
  57. 660 '
  58. 670 ' --- write error-handling and ending routines to S.BAT ---
  59. 680 '
  60. 690 PRINT #2,":ERROR1"
  61. 700 PRINT #2,"ECHO Subdirectory %1 not found.  Try again."
  62. 710 PRINT #2,"GOTO END"
  63. 720 PRINT #2,":ERROR2"
  64. 730 PRINT #2,"ECHO You must enter a subdirectory name after %0"
  65. 740 PRINT #2,":END"
  66. 750 '
  67. 760 ' --- cleanup and error routine ---
  68. 770 '
  69. 780 CLOSE:KILL "tempfile.":PRINT:LIST 180-270:END
  70. 790 IF ERR=53 THEN LIST 140-170 ELSE ON ERROR GOTO 0
  71.