home bbs files messages ]

Just a sample of the Echomail archive

<< oldest | < older | list | newer > | newest >> ]

 Message 178 
 Jeff Earle to All 
 Batch to check for text at end of file  
 02 Mar 25 11:20:12 
 
TID: Mystic BBS 1.12 A48
MSGID: 1:229/700 4fd37ca9
TZUTC: -0500
Hello all.
I need some help for a batch file that will test for specific text as the last
line of a .ans and .asc file and if the text is not there, it needs to add it.
I've been playing around with it and think I have the right code but I'm not
sure if it's got the right logic.
This is what I have so far. I've replaced specific path and file names with
[stuff] or (stuff) and the specific text to find is "|PA":

@echo off
c:
cd \[path to the batch file]

:ASC
for /f "tokens=*" %%a in (file.asc) do set "line=%%a"
echo "%line%"|findstr /i /c:"|PA" >nul
if errorlevel 1 (
 echo ^|PA>>file.asc
) else (
 goto ANS
)

:ANS
for /f "tokens=*" %%a in (file.ans) do set "line=%%a"
echo "%line%|findstr /i /c:"|PA" >nul
if errorlevel 1 (
 echo ^|PA>>file.ans
) else (
 goto END
)

:END

Is there anythimg I need to modify, add or remove to ensure the logic and
actions are correct?
Any help would be appreciated.

Thanks
(I hope it displays properly with the pipe codes in this message!)

... There will be a rain dance Friday night, weather permitting!

--- Mystic BBS v1.12 A48 (Windows/64)
 * Origin: Mystic Realms - A Social Media Alternative (1:229/700)
SEEN-BY: 105/81 106/201 128/187 129/305 153/7715 154/110 218/700 226/30
SEEN-BY: 227/114 229/110 111 114 206 317 400 426 428 470 664 700 705
SEEN-BY: 266/512 291/111 320/219 322/757 342/200 396/45 460/58 633/280
SEEN-BY: 712/848 902/26 5020/400 5075/35
PATH: 229/700 426


<< oldest | < older | list | newer > | newest >> ]

(c) 1994,  bbs@darkrealms.ca