🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.misc
Article #3924

overcoming the MSDOS errorlevel problem

#3924
From: John Savage
Date: Thu, 14 Dec 1995 00:00
19 lines
1608 bytes
Amongst the myriad shortcomings of MSDOS we must include the pair:

  *  FIND does not return an errorlevel to confirm a match
  *  COPY does not copy a file of length 0

Combined, these two can be used to overcome the limitation of no errorlevel
setting. When the output of FIND is redirected to a file, then failure to
match is indicated by the creation of a null file. Any attempt using COPY
to duplicate that file will be unsuccessful whenever the file is of size 0.

type %1 | find "xyz" >tmp1
copy tmp1 tmp0 > \nul
if exist tmp0 echo %1 contained the string xyz

In practice, the above will need to be preceded by: if exist tmp0 del tmp0
and the temporary files subsequently deleted by something like del tmp?
As always, use of a RAM drive for all temporary files is adviseable.
--
John Savage               koala@sydney.dialix.com.au
Technical Details
Message-ID: <4aou3r$h7o$1@sydney.DIALix.oz.au>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d683,b04f11c9c214bbc0,start
X-Google-Attributes: gid10d683,public
X-Google-Thread: f53ba,b04f11c9c214bbc0,start
X-Google-Attributes: gidf53ba,public
X-Google-Thread: 104805,b04f11c9c214bbc0,start
X-Google-Attributes: gid104805,public
X-Google-Thread: f71eb,b04f11c9c214bbc0,start
X-Google-Attributes: gidf71eb,public
From: John Savage <koala@sydney.dialix.com.au>
Subject: overcoming the MSDOS errorlevel problem
Date: 1995/12/14
Message-ID: <4aou3r$h7o$1@sydney.DIALix.oz.au>
X-Deja-AN: 121814420
sender: koala@sydney.DIALix.oz.au
organization: Gumleaf Smoke Signals Telegraph Co.
newsgroups: comp.os.msdos.misc,alt.msdos.batch,comp.sys.ibm.pc.misc,aus.computers.ibm-pc