TIP: Click on subject to list as thread! ANSI
echo: 4dos
to: Steve Steffler
from: Didier Weerts
date: 1998-11-05 18:22:46
subject: config file in a btm

Taisez-vous, ne parlez plus de Steve, le v'l…!

 ss> What methods can I use to get a batch file in 4DOS to read parameters
 ss> for its operation from a config file?

Here Is How I Can Do That..

Note That I Used A simple Text File.. There Is Another Possibility To Use
It In Bynary Mode, So.. Just Look The {at}FileWriteB Function..


.oOo.oOo.oOo.oOo.oOo. Begin MAIN.BAT .oOo.oOo.oOo.oOo.oOo.
SetLocal
::
:: Getting Last Env And Print Them
::
Iff Exist Conf.Txt Then
        Set FileNum=%{at}FileOpen[Conf.Txt,Read]
        Set Conf1=%{at}FileRead[%FileNum]
        Set Conf2=%{at}FileRead[%FileNum]
        Echo.
        Echo Last Config: %Conf1 And %Conf2
        Echo.
EndIff
::
:: Getting new vars
::
Input New 1st Var: %%Conf1
Input New 2nd Var: %%Conf2
::
:: Saving Them
::
If Exist Conf.Txt Del Conf.Txt /Q
Set FileNum=%{at}FileOpen[Conf.Txt,Append]
Set Size1=%{at}FileWrite[%FileNum,%Conf1]
Echo.
Echo.
Echo Conf1 (%Size1 bytes) Written in Conf.Txt
Set Size2=%{at}FileWrite[%FileNum,%Conf2]
Echo.
Echo Conf2 (%Size2 bytes) Written in Conf.Txt
Echo.
Set End=%{at}FileClose[%FileNum]
If %End Eq 0 Echo All Done^Quit
Echo An Error Happend! :-(

~-_-~-_-~-_-~-_-~-_-~-_-  End MAIN.BAT  -_-~-_-~-_-~-_-~-_-~-_-~


Hoping It's Helping You!!

The Corsaire..
                  And Remember: In CyberSpace, No One Can Hear You Screaming..
--- FMailX32 1.22
* Origin: Dead System... +32-81/215.876 * Mail Only.. (2:293/3409)
SEEN-BY: 396/1 632/0 371 633/260 267 270 371 635/506 728 639/252
@PATH: 293/3409 3212 106/2000 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.