RR.BTM - a batch file for use under 4DOS 3.0 (only) Purpose: to demonstrate some of 4DOS' more powerful batch file functions (and also to serve a useful purpose, maybe). -------------------------------------------------------------- (I picked the name "RR" because it was quick and easy to type.) -------------------------------------------------------------- When I got 4DOS 3.0 set up and running and read the docs, I was astonished to find out how much had been added to its batch processor. I decided to use those tricks, plus some external programs, to create a routine I'd always wished were in the PKZIP / PKUNZIP programs, but which their author has evidently never cared much about. That is: the ability to rename a "member" file *within* an archive rather than have to go through a bunch of arcane stuff at the DOS prompt to get the same effect. Well, this RR.BTM file doesn't magically create a new PKZIP or PKUNZIP function where none exists in the first place, but it does automate the process for you. And, like other 4DOS .BTM files, it's *quick*. It is also loaded with error-trapping - the kind I like to have in my batch files. But then, I'm compulsive. Even so the error trapping does NOT consume much time, thanks to the speed at which .BTM files execute under 4DOS 3.0. To run it, you are going to need PKZIP and PKUNZIP, of course. You will also need one other external program, RONSET.EXE, an outstanding new utility for batch files that manipulates environ- ment variables up one side and down the other. RONSET is the answer to a lot of people's dreams for batch file/environment variable functions done via a single fast utility. Go thou, and find RONSET.ZIP on a bulletin board. As of this date (3/18/89) the latest version is 2.1 - so look for RONSET21.ZIP. And if you upload this 4DOS-BTM.ZIP file somewhere, please also upload RONSET21.ZIP (with all the original stuff in it; please don't add RONSET to THIS archive, nor this one to the RONSET archive). -------------------------------------------------------------- D I S C L A I M E R RR.BTM is a *** DEMONSTRATION *** of some of 4DOS 3.0's more interesting and powerful batch file capabilities (and also shows off the RONSET program a little). You should inspect the batch file VERY carefully to ensure that path information in it is correct for your system. For instance, in several places it makes reference to a drive E:. This happens to be my own RAM disk. If you don't have a drive E:, you'll need to edit the batch file and change all occurrences of E: to whatever is appropriate for your system. Do NOT run this .BTM file on any .ZIP archives that are important to you, until you are **ABSOLUTELY** sure the .BTM's instructions are right for your system. Test it thoroughly before you take any risks with important .ZIP files. I have run it dozens of times on my system without a single error. But I can't guarantee its suitability, as written, for yours; you have to determine that for yourself. -------------------------------------------------------------- Viewing the batch file's contents: Use LIST.COM (from Vernon Buerg), the 4DOS internal LIST command, or any file viewer which allows you to see ESC characters as graphics characters. Trying to print the thing out will cause the ESC characters to disappear and might make your printer think you have gone bananas. Either that, or you might think *it* has. -------------------------------------------------------------- You will also need: o Enough environment space. Give yourself about 100 bytes, at least - just to be on the safe side. If you don't have that, the batch file might fail. CAUTION: THERE IS ALMOST NO ERROR-TRAPPING FOR "OUT OF ENVIRONMENT SPACE" sorts of errors in in the .BTM file!!! o ANSI.SYS as a device driver for your system - or some fully ANSI-compatible driver. There are lots of ANSI cursor positioning and text attribute commands in the .BTM file. o PKZIP and PKUNZIP should be in your PATH, unless you want to edit the batch file and add path information for each occurrence of the programs. RONSET.EXE should also be in your path. -------------------------------------------------------------- Why is the batch file so big? Because it is LOADED with comments. All major procedures are commented upon. But the batch file can be run quickly with the comments in it. Why? Each comment line begins with two NUL characters (ascii decimal value: 0). I found by accident that 4DOS will not process any line which begins with a NUL character - not on my machine, anyway (I run MS-DOS 3.3). When you remove the comments, it's roughly 5,800 bytes long. -------------------------------------------------------------- ANOTHER DISCLAIMER: Run the .BTM and watch carefully. If you immediately begin to hear your hard disk churning away, and you see a bunch of UNKNOWN COMMAND error messages coming back from 4DOS *immediately*, it probably means the NUL characters aren't working for you. That'd be a shame. 'Cuz it turns out that 4DOS passes over such comment lines so quickly, it's as if they aren't there at all. Even in a fast-running .BTM, they make a SUBSTANTIAL difference, compared with two other methods: using REM at the beginning of 'remark' lines, and a faster one - using a double colon at the beginning of 'remark' lines. A double colon will be processed as if it were a label, but one with an unusable name. Example: :: the next command is "DIR" but this line is a comment DIR -------------------------------------------------------------- Running the batch file: The syntax is: RR zip_file_name Where "zip_file_name" is replaced by the name of a .ZIP file containing a "member" file you want to rename. The .BTM file itself will prompt you for the rest of the information. Try it with and without the .ZIP extension. Try it with an extension that is NOT ".ZIP". Try it with wildcards. Once you have the batch file set up so that you know all of the file name and subdirectory info are correct for your system, try to make any number of "dumb" mistakes with it (EXCEPT for not having enough environment space when you run it). I'm sure I didn't trap all possible errors, but I got a lot of them. It's why I like to write batch files. *I* am in control of what they do. *I* can trap whatever errors I need to. A lot of free- ware and shareware utilities that manipulate .ZIP files have been written with cute screen displays and cute beeps, in mind, and have really poor error-trapping. If you want it done right, sometimes you gotta do it yourself. Mike Arst, Seattle, WA (reachable on the POVERTY ROCK BBS, (206) 232-1763 (Mercer Island, WA). ( E N D )