WITH 1.xx (c) 1995,1996 M&M Corporation Budapest This is a quite simple but extremely powerful batch enhancer utility, written in Turbo Pascal 7.0 Usage: ~~~~~~ WITH.EXE </|-qvcth?> <files|@list> <command> <params> Switches: ~~~~~~~~~ q quiet mode, no output v verbose mode, many output c confirm each file t search for program h help vh verbose help ? same as h e increment environment space by 1k (default=1k) Extra characters: ~~~~~~~~~~~~~~~~~ ~n filename only ~e extension only ~b both filename and extension ~s size of file ~) > redirect output ~! | pipe sign ~~ ~ character Character replacement: ~~~~~~~~~~~~~~~~~~~~~~ ~n:???????? <- exactly 8 characters! ~e:??? <- exactly 3 characters! You can use up to 16 separate masks in one command. But you won't, will you? I often write batch programs, and the longest command line I have ever used was approximately 60 characters long with its five or six parameters. So this value of 16 is more than enough. Examples: ~~~~~~~~~ > WITH *.PAS COPY ~B A: Same as COPY *.PAS A: > WITH /C *.PAS COPY ~B A:\~N.BAK This command copies all files with the extension of PAS to the root directory of drive A: under the same name, but with the extension of BAK. You must confirm before copying. > WITH *.PAS RENAME ~B ~N:_???????.~E:W?D This command renames all .PAS files to .WAD, and changes the first character in filename to '_' as well. > WITH /Q *.EXE;*.COM ~N /? ~!MORE This one displays the help of each executable file, and waits for a keypress after each screen. > WITH /Q *.EXE;*.COM ~N /? ~)~)ALLHELP.TXT This one writes the help of each executable file into ALLHELP.TXT > WITH /C *.EXE;*.COM ~N /? ~)~)ALLHELP.TXT Same as above, but you can select which files' help you want to store. Look at the 'Command:' line! > WITH *.TPU ECHO ~B ~)~)TPU.LST You can easily create listfiles. See the next example for help on using these lists with WITH! :-) > WITH @MYFILES.LST COPY ~B C:\MYDIR You can use listfiles as well. Moreover, you can use as much as you want. (ie. *.EXE;*.COM;@MY.LST;*.ZIP;*.WAD is a valid filespec) > WITH /EEE MY.BAT ~B You can set the environment space passed to your batch programs. The example above passes 4k of environmant space to MY.BAT /T switch ~~~~~~~~~ Since version 1.04b, you can test whether WITH.EXE can be found on your path or not. To do so, use the following method in your batch file: @ECHO OFF WITH /T IF ERRORLEVEL 255 GOTO FOUND GOTO NOTFOUND :FOUND ECHO I've found it! GOTO END :NOTFOUND ECHO I haven't found it! :END History: ~~~~~~~~ 0.00 Once upon a time there was MS-DOS. And there was the FOR command. And, of course, there was a displeased user, saying: "Grrmppf! I hate this command! I need something that allows me to use the files' names and their extensions SEPARATELY!" And the user began thinking... and then he said: "Why not?" 0.80b and below Procedure & function tests only 0.90 Tried: subdirectory reading. Removed immediately. (? v2.0) 1.00 First reliable version Works with ~E, ~N and /? only 1.01 Added: ~B extra character ~~ extra character 1.02 Added: /C switch 1.02b Minor changes in program structure Minor speed-up, optimizing 1.04 Added: character replacement for ~N and ~E Number of character masks limited to 64. (TOO MUCH!) 1.04b Minor changes Added: /T switch for BATCH processing Many, if not all of my BATCH programs used this version of WITH.EXE 1.10 Major changes in program structure ...I've read several books about programming, you know... :b Added: ~S extra character ~) extra character (YEAH!) /H switch /V switch /Q switch - or / are equivalent 1.10b Bug fixed in character replacement. '*' in name or extension mask now ends the string processing See WITH /C *.* ECHO ~N:???????? ~N:????* Number of NAME and EXT masks limited to 32. (? Too much) 1.10c Added: @LISTFILE reading Number of NAME and EXT masks limited to 16. 1.10d After calling LzEXE (or another similar progam) WITH.EXE found some names once again. Fixed. Number of NAME and EXT masks limited to 8. 1.10e WITH /V always said "No matching files". Fixed. 1.10f Minor changes. 1.11 Added: ~! extra character. 1.12 Added: /E switch Plans: ~~~~~~ More extra characters: ~D = current drive ~P = full path to filespec ~#xx = ANY character! ~#09 = TAB ~#20 = SPACE ~#0C = FORM FEED etc. 2.00+ /S switch (subdirectory reading) Comments & new ideas to: ~~~~~~~~~~~~~~~~~~~~~~~~ E-MAIL: mark@ludens.elte.hu VISIT MY HOMEPAGE AT: http://ludens.elte.hu/~mark/ SNAIL-MAIL: Molnár Márk Dél utca 29. 1239 Budapest Hungary