home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / UTILITY / BATCH / RUNAT10.ZIP / RUN@.DOC next >
Encoding:
Text File  |  1991-08-25  |  5.5 KB  |  147 lines

  1.  
  2.  
  3.                               R U N @  1.0
  4.                               ============
  5.  
  6.  
  7.                Free Software by TapirSoft Gisbert W.Selke
  8.  
  9. As per a user's request, this is a utility that executes a command once
  10. for each file included in a list of files.
  11.  
  12. The file list is read from StdIn and must contain one file name per
  13. line. The RUN@ call must include, on the command line, a command
  14. pattern, included in quotes, with a substitution marker, ^, somewhere.
  15. This marker is substituted by each file name in turn, and the resulting
  16. lines are written to a temporary batch file, normally RUN@@.BAT, which
  17. is executed once all the file names have been processed. This batch file
  18. destroys itself after execution.
  19.  
  20. Suppose a file called f.lst contains the following lines:
  21.  
  22.                 foo.bar
  23.                 oofa.c
  24.                 kermit.hlp
  25.  
  26. Then calling
  27.  
  28.                 run@ < f.lst "type ^"
  29.  
  30. will produce a batch file with the contents
  31.  
  32.                 type foo.bar
  33.                 type oofa.c
  34.                 type kermit.hlp
  35.                 del RUN@@.BAT
  36.  
  37. Alternatively, under DOS 5.0 and later, you could use a pipe as in
  38.  
  39.                 dir /b | run@ "type ^"
  40.  
  41. (Incidentally, the /b switch to the DIR command is essential in this
  42. example; however, it's a DIR feature new to DOS 5.0.)
  43.  
  44. That's basic operation; now, here are the frills:
  45.  
  46. You can specify one or more of the following command line switches which
  47. change RUN@'s behaviour:
  48.  
  49. The /m switch requests manual execution. Normally, the resulting batch
  50. file is created, executed, and deleted, so that you never get to see it.
  51. In certain cases, you will want to execute it by hand; in particular, if
  52. the command to be executed installs a TSR part, like DOS PRINT does when
  53. called for the first time, or whenever the DOS environment is about to
  54. be changed. Using the /m switch prevents automatic execution; you have
  55. to execute the batch file yourself by invoking it at the command line.
  56. Note that the very last thing that the batch file does is to destroy
  57. itself; if you want to keep it, specify the /k option, which is
  58. independent of the use of /m. Examples:
  59.  
  60.                 run@ < f.lst "print ^" /m
  61.                 run@ < f.lst "attrib +r ^" /k
  62.                 run@ < f.lst "attrib +r ^" /k
  63.  
  64. Normally, the batch file echoes all its commands; if you want it to
  65. execute quietly, use the /q switch.
  66.  
  67. If, for some reason, you want a file name other than RUN@@.BAT for the
  68. resulting file, you can specify it with the /f switch, directly followed
  69. by the file name you want, with no intervening spaces. The .BAT
  70. extension is added automatically, unless the name you gave already
  71. includes a period. Example:
  72.  
  73.                 run@ < f.lst "more < ^" /fmoron
  74.  
  75. will create a batch file named MORON.BAT. By the way, if you include one
  76. of the /k, /m, or /f options, any existing file of the same name is
  77. overwritten mercilessly (unless write-protected, in which case an error
  78. occurs). With the no-frills call described in the beginning, RUN@ takes
  79. care not to overwrite any existing files.
  80.  
  81. Finally, if you don't like the substitution marker, ^, e.g., because it
  82. conflicts with your CED, you can specify a different one with the /s
  83. switch, where the desired marker must follow immediately after the /s.
  84. Example:
  85.  
  86.                 run@ < f.lst "attrib +r #" /s#
  87.  
  88. will work on CED-equipped systems, too.
  89.  
  90. You can use either single or double quotes; you cannot include the quote
  91. character you chose within the string itself.
  92.  
  93. Here, finally, are two more examples of RUN@ usage:
  94.  
  95.                 dir /b /s | run@ "del ^" /m
  96.  
  97. will create a batch file RUN@@.BAT which, when run, will delete all
  98. files in the current directory and all its sub-directories (DOS 5.0 and
  99. later only). Use at your own risk!
  100.  
  101. Suppose, then, we have a file named CHI.X:
  102.  
  103.                 Marilyn
  104.                 Mae
  105.                 Marlene
  106.                 Raquel
  107.                 Brigitte
  108.                 Claudia
  109.                 Gina
  110.                 Fanny
  111.  
  112. then the command
  113.  
  114. sort < chi.x | run@ "^ darling, wish you were here, oh sweet ^!" /k/m/fadore.txt
  115.  
  116. will produce a file ADORE.TXT with the contents:
  117.  
  118.                 Brigitte darling, wish you were here, oh sweet Brigitte!
  119.                 Claudia darling, wish you were here, oh sweet Claudia!
  120.                 Fanny darling, wish you were here, oh sweet Fanny!
  121.                 Gina darling, wish you were here, oh sweet Gina!
  122.                 Mae darling, wish you were here, oh sweet Mae!
  123.                 Marilyn darling, wish you were here, oh sweet Marilyn!
  124.                 Marlene darling, wish you were here, oh sweet Marlene!
  125.                 Raquel darling, wish you were here, oh sweet Raquel!
  126.  
  127. The usual disclaimers apply:
  128.  
  129. This is free software, meaning you can use and copy it as you please,
  130. but don't sell it coz I retain the copyright. It comes without any
  131. guarantees whatsoever, and I can't be held responsible for anything I do
  132. or may have done. If it doesn't work as advertised, let me know at the
  133. address given below; if you need more functionality, however, I'd
  134. recommend you write a wee AWK programme to do all the pattern processing
  135. or whatnot that you need. Gnu AWK and other implementations for MS DOS
  136. are available from many fine software places for free.
  137.  
  138. CED is a fine piece of software copyrighted by Chris Dunford of the Cove
  139. Software Group, as far as I know.
  140.  
  141. Gisbert W.Selke
  142. Ermekeilstraße 28
  143. D-5300 Bonn 1
  144. Germany
  145. <S00100@DBNRHRZ1.BITNET>
  146.  
  147.