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 >
Wrap
BASIC Source File
|
1993-03-01
|
2KB
|
71 lines
100 'BATMAKR2.BAS -- by Paul Somerson
110 ' (c) 1987 Ziff Communications Co.
120 'This creates easy subdirectory switcher files
130 ' (And puts them all in one very long file.)
140 'Before you use this, get into DOS and type:
150 '
160 ' CHKDSK / V | FIND "Dir" > TEMPFILE
170 '
180 'For this to work properly, make sure each
190 ' subdirectory has its own unique name.
200 'To switch between subdirectories in DOS, type
210 ' S and then the name of the subdirectory
220 ' WITHOUT the "CD\" prefix, and WITHOUT the
230 ' long PATHname that usually precedes it.
240 'For instance, to switch to \DOS\BIN, type:
250 ' S BIN
260 'DON'T run S.BAT on a floppy disk. For best
270 ' results, run it on a RAMdisk you've PATHed to.
280 '
290 DIM B$(300),C$(300),F$(300)
300 ON ERROR GOTO 790
310 '
320 ' --- read raw file, truncate left end of each line ---
330 '
340 OPEN "tempfile" FOR INPUT AS #1
350 IF EOF(1) THEN 500 ELSE LINE INPUT #1,A$
360 B$(K)=RIGHT$(A$,LEN(A$)-10):IF B$(K)="\" THEN 350
370 FOR A=LEN(B$(K)) TO 1 STEP -1
380 IF MID$(B$(K),A,1)="\" THEN C$(K)=RIGHT$(B$(K),LEN(B$(K))-A):GOTO 430
390 NEXT
400 '
410 ' --- create lowercase version of each test ---
420 '
430 FOR D=1 TO LEN(C$(K))
440 F$(K)=F$(K)+CHR$(ASC(MID$(C$(K),D,1)) OR 32)
450 NEXT
460 K=K+1:GOTO 350
470 '
480 ' --- write upper- and lowercase tests to S.BAT ---
490 '
500 OPEN "S.BAT" FOR OUTPUT AS #2
510 PRINT #2,"ECHO OFF"
520 PRINT #2,"IF %1@==@ GOTO ERROR2"
530 FOR A=1 TO K-1
540 PRINT #2,"IF %1==";C$(A);" goto ";C$(A)
550 PRINT #2,"IF %1==";F$(A);" goto ";C$(A)
560 NEXT
570 PRINT #2,"GOTO ERROR1"
580 '
590 ' --- write actual CD instructions to S.BAT ---
600 '
610 FOR A=1 TO K-1
620 PRINT #2,":"+C$(A)
630 PRINT #2,"CD"+CHR$(32)+B$(A)
640 PRINT #2,"GOTO END"
650 NEXT
660 '
670 ' --- write error-handling and ending routines to S.BAT ---
680 '
690 PRINT #2,":ERROR1"
700 PRINT #2,"ECHO Subdirectory %1 not found. Try again."
710 PRINT #2,"GOTO END"
720 PRINT #2,":ERROR2"
730 PRINT #2,"ECHO You must enter a subdirectory name after %0"
740 PRINT #2,":END"
750 '
760 ' --- cleanup and error routine ---
770 '
780 CLOSE:KILL "tempfile.":PRINT:LIST 180-270:END
790 IF ERR=53 THEN LIST 140-170 ELSE ON ERROR GOTO 0