home *** CD-ROM | disk | FTP | other *** search
- 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
- From: kgs@cnmss.tredydev.unisys.com (Ken Salter)
- Newsgroups: alt.msdos.programmer
- Subject: Re: Batch files
- Keywords: starfish and coffee...
- Message-ID: <1993Jan26.165944.8338@cnmss.tredydev.unisys.com>
- Date: 26 Jan 93 16:59:44 GMT
- References: <1993Jan24.135115.10741@gmuvax2.gmu.edu> <1993Jan25.134613.1@csc.canterbury.ac.nz> <1993Jan25.152249.8789@udel.edu>
- Organization: Unisys Corporation, Tredyffrin
- Lines: 54
-
- In article <1993Jan24.135115.10741@gmuvax2.gmu.edu>, skhan@gmuvax2.gmu.edu
- (Shahab Raza Khan) asks for ways generate and/or modify batch files.
- Some useful techniques are:
-
- Technique #1:
- ------------
- Use batch file parameters. E.g.,
-
- prompt> call batch %ENV-VAR%
-
- This call necessarily occurs within another batch file; otherwise,
- ENV-VAR won't be replaced by its value
-
-
- Technique #2:
- ------------
- prompt> echo stuff1 %ENV-VAR% stuff2 >>temp
- prompt> copy prefix+temp+suffix target.bat
- prompt> call target
- prompt> del temp
- prompt> del target.bat
-
-
- Technique #3:
- ------------
- prompt> edlin batchfil.bat <commands.ed >NUL
-
- where commands.ed contains
-
- 1,#roldstuff1^Znewstuff1
- 1,#roldstuff2^Znewstuff2
- ...
- e
-
- Since commands.ed contains control characters, you have to use the /B
- switch when you edit it. That is,
-
- edlin /B commands.ed
-
- If you're still using MSDOS 3.3 (as I am), the B in /B must be in the
- upper case. Also, the simplest way I know to print commands.ed is:
-
- edlin /B commands.ed >print.fil
- l
- q
- y
-
- Another caution: edlin won't operate on a read-only file,
- so if you set the read-only attribute, you won't be able to
- inspect commands.ed directly.
-
- Hope this helps,
-
- Ken Salter
-