




================================================================================
----------------------------READINI.EXE and WRITEINI----------------------------
================================================================================




        This document describes the history, purpose and usage of
the two programs WRITEINI.EXE and READINI.EXE.  These two programs are
Shareware, and are yours to evaluate free of charge.  Should you choose
to continue to use either program, then a small contribution of $10 each
will register you and entitle you to future upgrades, notices and
other programs.

        Send payment in the form of check or money order to:

                          Eric Hainline
                          2212 E.Orangegrove Ave.
                          Orange, CA.  92667

        Make sure and include your name, your postal address, and any
EMail address (Compuserve, Internet, ATTMail, SprintMail or MCIMail)
that may be used to contact you electronically.


--------------------------------------------------------------------------------
                     
                     
                     copyright 1993  Eric Hainline

                          TABLE OF CONTENTS

        1)      License                                 Page  2
        
        2)      Introduction                            Page  3

        3)      Installation                            Page  3

        4)      WRITEINI
                        Conventions                     Page  4

                        Usage                           Page  5

                        Removing information with NULL  Page  5

                        Message Modes                   Page  6

        5)      READINI
                        Conventions                     Page  8

                        Usage                           Page  9

                        Message Modes                   Page 11

                                     (-1-)
===============================================================================
LICENSE:



WRITEINI.EXE and READINI.EXE are Copyright (c) 1993 by Eric Hainline.

All users are granted a limited license to copy WRITEINI.EXE and READINI.EXE
only for the purpose of allowing others to try it, subject to the following
restrictions:

WRITEINI.EXE and READINI.EXE must be distributed in absolutely unmodified
form, including ALL program, documentation, and other files.

WRITEINI.EXE and READINI.EXE may not be included with any other product
for any reason whatsoever without a license from Eric Hainline.

No charge or payment may be levied or accepted for WRITEINI.EXE or
READINI.EXE other than by Eric Hainline.

Bulletin Board system operators may post the unregistered version of 
WRITEINI.EXE and READINI.EXE on their BBS for downloading by their users
without written permission only if the above conditions are met, and only
if no special fee is necessary to access the WRITEINI.EXE and READINI.EXE
files (a general fee to access the BBS is ok).

Distributors of User Supported and Public Domain software MUST obtain
written permission from Eric Hainline before distributing WRITEINI.EXE
and READINI.EXE and must follow the above conditions. Permission is almost
always granted; this requirement is necessary to ensure protection for
ourselves and WRITEINI.EXE and READINI.EXE users from unscrupulous
individuals.



























                                     (-2-)
===============================================================================
INTRODUCTION:
        History
        -----------------------------------------------------------------------
        These programs came out of several years of frustration
trying to find a standard way to manage change in networked PCs running
Windows.  A small group of us (read that 4) were charged with the
responsibility of implementing a company-wide replacement to a network
of Wang VS minicomputers, and extend the coverage of computers to all
personnel.
        This project started in April, 1990, just in time for the famous
May 1,1990 introduction of Windows 3.0.  We jumped on the bandwagon
immediately and committed our company to Windows.  Within 24 months we
had 1500 PCs running Windows exclusively all networked together in one
large client-server network.
        This was, of course, years ahead of everybody else - most
importantly vendors.  So we had to invent many things ourselves.  One of
our standards was to install the PCs with 120MB hard drives and run all
of our programs from local disk.  This has increased performance and
reduced Windows/Networking problems immensely (compared to what I have
read over the last three years), but it did create many administrative
headaches.
        One of these was what to do about modifying WIN.INI and SYSTEM.INI
before Windows was launched without replacing the entire file and messing
up anything the user had going on their own.
        The answer?  TADA!  WRITEINI.EXE and READINI.EXE.  I wrote the 
early versions of these as one-time shots for specific upgrades (from Win 
3.0 to Win 3.1 and from Word 1.1 to Word 2.0).  The versions that you
find here I have taken and enhanced with user help, lots of error checking
and error handling, and many other options found in the Windows API
counterparts that we do not need to use at the office (because we generally
know what we need to change to what, so these do not have to be all-purpose).
        We have lots of other stuff for management tools, and not all of
them warrant being help privately.  Based on your comments, questions, and
suggestions, I may be willing to recode them for the public.
        Anyway, I hope that you find these programs useful and I would wish
that you keep track of your experiences with them and write to me with any 
comments, suggestions or bug reports.  Good luck and enjoy!




===============================================================================
INSTALLATION:
        Neither program requires installation.  They can run from any DOS
drive and path location against any INI styled file in any DOS drive and 
path location.












                                     (-3-)
===============================================================================
WRITEINI.EXE:

        Conventions
        -----------------------------------------------------------------------
        WRITEINI will write a desired value out to any available file 
formatted along the lines of the typical Windows-type INI file.  It will
write the information out as the proper value for any item found within 
any section.  If the item, section or file do not exist, they will be 
created.  Using the text NULL will remove an item from any section, or 
remove any section from any file.  WRITEINI will not remove a file, you
have that ability from DOS already.

        For those of familiar with writing Windows appplications against
the Windows APIs WriteProfile and WritePrivateProfile, this is the DOS
equivalent.  And I feel that it is superior because of two features.
First, you do not need to go to any exhaustive research to figure out the
proper method of implementing NULL to remove information from files, and 
second the method of decribing the information to be written to the file
is in an order that is far more intuitive.

        For the purposes of WRITEINI.EXE, the following naming convention 
will be used (with apologies to Microsoft):

        FILE is any DOS text file that may contain information layed out
                in the format commonly associated with files with INI
                extensions.  Most commonly but not exclusively Windows
                applications settings files.
        SECTION is any set of related settings within a FILE, where the
                first line of the set is the title (or handle) of the
                section, followed by the related settings.  The title of
                the SECTION is marked by an open bracket ( "[" ) at the 
                first position, then the title, then a close bracket ( "]" ).

                example:        [Section]

                A SECTION is contigous until either the end of the FILE or
                the beginning of the next SECTION.

        ITEM is the title (or handle) of any DATA value within a SECTION.
                The ITEM NAME is the value that preceeds an equals sign
                ( "=" ) on a settings line.

                example:        [Section]
                                Item =

                There is only one ITEM allowed per line of text.

        DATA is the actual setting control referenced by the ITEM label.
                The DATA is the text value(s) that follow the equals sign
                ( "=" ) on an ITEM line.

                example:        [Section]
                                Item=Data





                                     (-4-)
===============================================================================
WRITEINI.EXE (cont.)

        
        Usage
        -----------------------------------------------------------------------
        The usage of WRITEINI.EXE is as follows (and the same information 
is displayed as online help text when requested).

          writeini /f=<target INI file>
                   /s=<target section name>
                   /i=<target item name>
                   /d=<target data value>

OPTIONAL:          /m=v (verbose - default), /m=q (quiet), /m=s (stealth)

EXAMPLE:  writeini /f=c:\windows\win.ini /s=windows /i=load /d=clock.exe
            (this will change the LOAD= line to be LOAD=CLOCK.EXE)

        So you see by the above example that they way the you would use 
WRITEINI is fairly straight forward.  Enter the command followed by the
name of the file you want to change, the name of the section in the file,
the name of the item within the section, and the data value that you want
the item to be.  Of course, you can place the switches on the command line 
in any order and the program will still work.

        ***************************NOTE**************************** 
           WRITEINI writes all information out in uppercase.  If
           this is a problem, let me know and I will enhance it.
        ***********************************************************

        ***************************NOTE**************************** 
           WRITEINI does not check for readonly file flags.  If
           this is a problem, let me know and I will enhance it.
        ***********************************************************

        Removing information with NULL
        -----------------------------------------------------------------------
        To use WRITEINI to remove information from an INI-type file, you
simply replace certain infromation with the word NULL (if you ever need to
change a data value in an INI file to be the text "NULL", this program will
not work.  Let me know if that is a problem and I will correct it for you.)

        To remove the Load= line from your WIN.INI file, you would use
the following command:

          writeini /f=c:\windows\win.ini /s=windows /i=load /d=null
            (this will delete the LOAD= line)
          
        To remove the entire [Windows] section from your WIN.INI file, 
you would use the following command:

          writeini /f=c:\windows\win.ini /s=windows /i=null

Note the the /d switch is not required when removing a section.  That
only makes proper common sense.



                                     (-5-)
===============================================================================
WRITEINI.EXE (cont.)

        
        
        Message Modes                 
        -----------------------------------------------------------------------
        There are several Message Modes you can use with WRITEINI.EXE,
depending on how you intend to use it.  Sometimes it makes sense to
provide all status information of what transpires when running the program
and sometimes you want to hide the process (for instance, when updating
a file during a network logon script).

        WRITEINI.EXE has three Message Modes

        VERBOSE (default) - tells you everything, and in meaningful
                colors, of what is happening.

                Screen is ALWAYS cleared
                Title and copyright are printed in cyan

                RED - File not found if attempt is made to remove something.

                YELLOW - Warnings if file had to be created, and/or section
                        had to be created, and/or item had to be created or
                        inserted.

                        Warnings if section not found in file and section
                        was targeted for removal, or if item not found within 
                        section and item targeted for removal (lets you know
                        that the stuff was never there in the first place
                        [maybe that was a reason for some problem] but does
                        not generate a RED condition error.)

                GREEN - Ok.  Target item properly changed or removed.
                        (Remember, adds will be yellow.)

                        
        QUIET - alerts you to unforeseen circumstances only, and in 
                meaningful colors.

                Screen is NEVER cleared
                Title and copyright are NOT printed

                RED - File not found if attempt is made to remove something.

                YELLOW - Warnings if file had to be created, and/or section
                        had to be created, and/or item had to be created or
                        inserted.

                        Warnings if section not found in file and section
                        was targeted for removal, or if item not found within 
                        section and item targeted for removal (lets you know
                        that the stuff was never there in the first place
                        [maybe that was a reason for some problem] but does
                        not generate a RED condition error.)



                                     (-6-)
===============================================================================
WRITEINI.EXE (cont.)

        
        QUIET - (continued)        
                
                GREEN - Green messages (positive acknowledgements) are NEVER
                        displayed.

                      
        STEALTH - As the name implies, NO MESSAGES ARE DISPLAYED.  The only
                        evidence that the program has run is one line feed.
                        Send me a request if that one line feed is a problem
                        and I will correct it.
        
        
        One comment about the Message Mode switch ( "/m" ).  If it is not
set to STEALTH, an invalid command (such as a missing switch value) will
result in the display of the Help Screen.  In the middle of the Help Text,
you will see a line displayed, white text on red background, that will tell
you exactly what switch or switches were missing.  That should help you a
great deal if you are only a casual user of this program.





































                                     (-7-)
===============================================================================
READINI.EXE:

        Conventions
        -----------------------------------------------------------------------
        READINI solves a different problem from WRITEINI.  READINI is 
designed to extract information from file formatted along the lines of 
the typical Windows-type INI file.  It will write the information out 
to a batch file that can be subsequently run, inserting the desired
data into an environmental variable.  This variable can then be tested
on and/or otherwise manipulated by the calling bathc program.  READINI
is not intended to be used by an operator from a command line.  It is
intended to be used from a calling batch program.

        For example, suppose that you wanted to add the value of CLOCK.EXE
to the Load= line of WIN.INI.  One method would be to do it yourself, but
if you support a large number of PCs then the work is fairly cumbersome.
Another method would be to have your user community to it themselves, but
that is mistake prone, and not guaranteed to be implemented.  A third method
would be to just replace whatever is already in the Load= line with CLOCK.EXE,
but that would destroy other processes already automated by you or others.

        READINI solves this by allowing you to extract any existing value
found on the Load= line, push it into an environmental variable of your
choosing, then pull it back down and append it to "CLOCK.EXE," where you
can then run WRITEINI.EXE and replace the value for Load= with your new
addition.  This would handle all circumstances from no value to complex value.

        As another example, suppose you needed to know if which PCs were
running with 32 Bit Disk Access and which were not.  You could read the
386Enhanced section of SYSTEM.INI and extract the value for 32BitDiskAccess=
and then test for the environment variable and either just report it by
added the information to a text file or act on it by turning the value on
or off with WRITEINI.EXE.

        READINI.EXE solves these requirements and extends the usefulness
of WRITEINI.EXE.  Combined, they can even be used to work against personal
INI files and toggle configurations, change and reboot computers (with a
REBOOT.COM type of product), generate notices of pending or scheduled
changes, and automate remote support processes.

        For the purposes of READINI.EXE, the following naming convention 
will be used (with apologies to Microsoft):

        FILE is any DOS text file that may contain information layed out
                in the format commonly associated with files with INI
                extensions.  Most commonly but not exclusively Windows
                applications settings files.
        SECTION is any set of related settings within a FILE, where the
                first line of the set is the title (or handle) of the
                section, followed by the related settings.  The title of
                the SECTION is marked by an open bracket ( "[" ) at the 
                first position, then the title, then a close bracket ( "]" ).

                example:        [Section]




                                     (-8-)
===============================================================================
READINI.EXE (cont.)

        Conventions (continued)
        -----------------------------------------------------------------------
                A SECTION is contigous until either the end of the FILE or
                the beginning of the next SECTION.

        ITEM is the title (or handle) of any DATA value within a SECTION.
                The ITEM NAME is the value that preceeds an equals sign
                ( "=" ) on a settings line.

                example:        [Section]
                                Item =

                There is only one ITEM allowed per line of text.

        DATA is the actual setting control referenced by the ITEM label.
                The DATA is the text value(s) that follow the equals sign
                ( "=" ) on an ITEM line.

                example:        [Section]
                                Item=Data


        Usage
        -----------------------------------------------------------------------
        The usage of READINI.EXE is as follows (and the same information 
is displayed as online help text when requested).

          readini /f=<source INI file>
                  /s=<source section name>
                  /i=<source item value>
                  /o=<output file name> (do not extensions)
                  /v=<environment variable label for data>

OPTIONAL:         /m=v (verbose - default), /m=q (quiet), /m=s (stealth)

EXAMPLE:  readini /f=c:\windows\win.ini /s=windows /i=load /o=c:\env /v=winload
          
        This command will create the file env.bat in the root directory 
of C:, which will contain the single line:
              SET WINLOAD=xxxxx
where xxxxx equals the value for load= in the win.ini file.  NOTE THAT THE
HANDLE OF THE ENVIRONMENT VARIABLE AND THE ENVIRONMENT STRING ITESELF WILL
ALL BE IN UPPERCASE TEXT.  Remember that when testing for the information
later.

        Again though, until you run the batch file c:\env.bat before you
get the information where you deal with it from an automated process.  So
a better demonstration of usage would be to provide the logic of a demo
batch file.

        The first example batch file will extract any information found 
on the spooler= line in the Windows section of WIN.INI and display it to 
the screen.



                                     (-9-)
===============================================================================
READINI.EXE (cont.):

        Usage (continued)
        -----------------------------------------------------------------------
        
        @echo off
        cls
        c:
        cd\
        readini /f=c:\windows\win.ini /s=windows /i=spooler /o=c:\temp /v=spool
        call c:\temp.bat
        del c:\temp.bat
        if %SPOOL% == NO goto OFF
        if %SPOOL% == YES goto ON
        goto ERROR
        
        :ON
        @echo The Spooler is currently set to ON.
        goto END
        
        :OFF
        @echo The Spooler is currently set to OFF.
        goto END
        
        :ERROR
        @echo You do not have a spooler line in the Windows section of WIN.INI
        
        :END
        

        The second example will insert the value CLOCK.EXE into the Load=
line in the Windows section of WIN.INI.

        @echo off
        cls
        c:
        cd\
        readini /f=c:\windows\win.ini /s=windows /i=load /o=c:\temp /v=load
        call c:\temp.bat
        del c:\temp.bat
        writeini /f=c:\windows\win.ini /s=windows /i=load /d=CLOCK.EXE,%LOAD%


        ***************************NOTE**************************** 
           READINI writes all information out in uppercase.  If
           this is a problem, let me know and I will enhance it.
        ***********************************************************

        ***************************NOTE**************************** 
           READINI does not check for readonly file flags.  If
           this is a problem, let me know and I will enhance it.
        ***********************************************************
        
        
        


        
                                    (-10-)
===============================================================================
READINI.EXE (cont.):

        Message Modes                 
        -----------------------------------------------------------------------
        There are several Message Modes you can use with READINI.EXE,
depending on how you intend to use it.  Sometimes it makes sense to
provide all status information of what transpires when running the program
and sometimes you want to hide the process (for instance, when testing
a file during a network logon script).

        READINI.EXE has three Message Modes

        VERBOSE (default) - tells you everything, and in meaningful
                colors, of what is happening.

                Screen is ALWAYS cleared
                Title and copyright are printed in cyan

                RED - Source file not found.

                YELLOW - Warnings if section not found in source file, or if 
                        item not found within source section.  Environmental
                        variable will be set to ZZZ so that you can test for
                        this condition.

                GREEN - Ok.  Source data was read and written to file.

                        
        QUIET - alerts you to unforeseen circumstances only, and in 
                meaningful colors.

                Screen is NEVER cleared
                Title and copyright are NOT printed

                RED - Source file not found.

                YELLOW - Warnings if section not found in source file, or if 
                        item not found within source section.  Environmental
                        variable will be set to ZZZ so that you can test for
                        this condition.
                
                GREEN - Green messages (positive acknowledgements) are NEVER
                        displayed.

                      
        STEALTH - As the name implies, NO MESSAGES ARE DISPLAYED.  The only
                        evidence that the program has run is one line feed.
                        Send me a request if that one line feed is a problem
                        and I will correct it.
       
        One comment about the Message Mode switch ( "/m" ).  If it is not
set to STEALTH, an invalid command (such as a missing switch value) will
result in the display of the Help Screen.  In the middle of the Help Text,
you will see a line displayed, white text on red background, that will tell
you exactly what switch or switches were missing.  That should help you a
great deal if you are only a casual user of this program.
                              
                              
                                    (-11-)
