From Jeff Earle@1:229/700 to All on Sun Mar 2 11:20:12 2025
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)
Who's Online
Recent Visitors
Dextile
Sun Aug 31 01:48:21 2025
from
Calgary, Ab
via
Telnet
Dextile
Sat Aug 30 21:04:48 2025
from
Calgary, Ab
via
Telnet
Dextile
Fri Aug 29 06:00:23 2025
from
Calgary, Ab
via
Telnet
Frostbane
Thu Aug 28 15:28:18 2025
from
Arizona
via
HTTPS
System Info
Sysop:
deepend
Location:
Calgary, Alberta
Users:
277
Nodes:
10 (0
/
10)
Uptime:
116:28:04
Calls:
2,343
Calls today:
1
Files:
4,967
D/L today:
47 files
(19,665K bytes)
Messages:
427,748
Synchronet Oneliners
Vintagegeek@rdbbs Tue Jun 24 16:54:23 2025 Leaving Mars at 17:15 on to Jupiter
Guest@rdbbs Wed Jul 2 12:37:39 2025 This is the good stuff
Vintagegeek@rdbbs Sat Jul 12 08:53:00 2025 Heading to the Scottish Open
Vintagegeek@rdbbs Sat Aug 9 05:39:24 2025 Kelly
Vintagegeek@rdbbs Tue Aug 12 07:14:02 2025 Cass
Vintagegeek@rdbbs Fri Aug 22 05:53:33 2025 OpenWide