home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / alt / msdos / programm / 3255 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  1.7 KB

  1. Path: sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!hal.com!olivea!spool.mu.edu!yale.edu!newsserver.jvnc.net!louie!udel!gvls1!tredysvr!cnmss!kgs
  2. From: kgs@cnmss.tredydev.unisys.com (Ken Salter)
  3. Newsgroups: alt.msdos.programmer
  4. Subject: Re: Batch files
  5. Keywords: starfish and coffee...
  6. Message-ID: <1993Jan26.165944.8338@cnmss.tredydev.unisys.com>
  7. Date: 26 Jan 93 16:59:44 GMT
  8. References: <1993Jan24.135115.10741@gmuvax2.gmu.edu> <1993Jan25.134613.1@csc.canterbury.ac.nz> <1993Jan25.152249.8789@udel.edu>
  9. Organization: Unisys Corporation, Tredyffrin
  10. Lines: 54
  11.  
  12. In article <1993Jan24.135115.10741@gmuvax2.gmu.edu>, skhan@gmuvax2.gmu.edu
  13. (Shahab Raza Khan) asks for ways generate and/or modify batch files.
  14. Some useful techniques are:
  15.  
  16. Technique #1:
  17. ------------
  18. Use batch file parameters.  E.g.,
  19.  
  20. prompt> call batch %ENV-VAR%
  21.  
  22. This call necessarily occurs within another batch file; otherwise,
  23. ENV-VAR won't be replaced by its value
  24.  
  25.  
  26. Technique #2:
  27. ------------
  28. prompt> echo stuff1 %ENV-VAR% stuff2 >>temp
  29. prompt> copy prefix+temp+suffix target.bat
  30. prompt> call target
  31. prompt> del temp
  32. prompt> del target.bat
  33.  
  34.  
  35. Technique #3:
  36. ------------
  37. prompt> edlin batchfil.bat <commands.ed >NUL
  38.  
  39. where commands.ed contains 
  40.     
  41.         1,#roldstuff1^Znewstuff1
  42.         1,#roldstuff2^Znewstuff2
  43.                ...
  44.         e
  45.  
  46. Since commands.ed contains control characters, you have to use the /B
  47. switch when you edit it.  That is,
  48.  
  49.         edlin /B commands.ed
  50.  
  51. If you're still using MSDOS 3.3 (as I am), the B in /B must be in the
  52. upper case.  Also, the simplest way I know to print commands.ed is:
  53.  
  54.         edlin /B commands.ed >print.fil
  55.         l
  56.         q
  57.         y
  58.  
  59. Another caution:  edlin won't operate on a read-only file,
  60. so if you set the read-only attribute, you won't be able to
  61. inspect commands.ed directly.
  62.  
  63. Hope this helps,
  64.  
  65. Ken Salter
  66.