INISED v. 1.1 (BBS, 18/12/1994, Paul Gallagher) |
Readme/What's new |
INISED v1.0 - Utility to Manipulate Windows-style Profile (INI) files
=====================================================================
Copywrite (c) Paul Gallagher 1994.
The author grants general permission to distribute and use this package,
provide it remains complete as detailed in section (1), is not modified
in any way, and is not sold for more than a reasonable media and
distribution charge.
Contents of this file:
1. Package
2. Version History
3. Contacting the author
4. System Requirements
5. About INISED
6. Using INISED
1. Package
==========
INISED.TXT = this file
DOS\INISED.EXE = DOS executable
OS2\INISED.EXE = OS/2 v2.x executable
2. Version History
==================
94.12.18 : v1.0 for DOS and OS/2. The OS/2 exe should run under NT,
but this hasn't been tested yet!
3. Contacting the Author
========================
Paul Gallagher:
Contact me by mail at <paulg@resmel.bhp.com.au>
tel: +61-3-566-1023 (BH Australian Eastern time).
4. System Requirements
======================
INISED requires DOS v3.x or higher, or OS/2 v2.0 or higher.
5. About INISED
===============
INISED is a command line utility (OS/2 and DOS versions included)
that can read and write values to/from Windows-style profile
files (INI files). It is intended to automate the reconfiguring
of programs without the need to maintain multiple versions on INI
files. INISED can manipulate files based on command line parameters,
or can read a sequence of commands from a script file.
6. Using INISED
===============
(NB. DOS or OS2 versions operate identically)
Getting help: INISED -?
First a bit about INI file terminology. The Windows Profile (INI)
file format is text, whereas OS/2 support binary INI files. This
utility does *not* support binary INI files, so the OS/2 format will
not be discussed further.
In an INI file, we basically have a series of keyed definitions
contained within application sections, as follows...
[section]
keyname=value
keyname=value
[section]
keyname=value
Obviously, actual section and key names should be unique.
INISED provides a means of reading and writing values to INI files
based on the section and key.
Each INISED command provides a selection of the following information:
. INI file name
. section name
. key name
. value
. default
The INISED can take all of this information on a command line. For example,
the following command issued at the DOS prompt will read the value of the
key called "shell" in the "boot" section of the SYSTEM.INI file:
INISED system.ini boot shell
the following command is used to set the key to a new value:
INISED system.ini boot shell=appbar
This example demonstrates the purpose of INISED quite well: say you wanted
to use the boot configuration manager in DOS 6 and higher to create 2
system configurations: one that brought Windows up with the standard
Program Manager, and a personal config that used AppBar as the Windows
shell. You could create two SYSTEM.INI files, and have the AUTOEXEC.BAT
file copy the appropriate file into the Windows directory at boot, but what
about preserving changes that may have been made to the file, by installing
some new software for example. You could go through the laborious process
of migrating SYSTEM.INI modifications to your "master" INI files, but
this is not very practical. The easier solution is to use INISED to modify the
"shell" specification in situ: use it to modify the *current* SYSTEM.INI
file, thus preserving any modification made since you established your
multiple configurations.
Command line operations
=======================
So, what are the range of commands that you can give INISED? There
are a few, but most are based on the common syntax...
INISED inifile section[= | keyname[= |=value | default]]
in the above, [] brackets enclose optional entries (and are not to be entered
as part of the command, and the | character seperates alternatives.
If we expand the command into all its permutations, we get:
- read a keyed value
INISED inifile section keyname
- read a keyed value, with default
INISED inifile section keyname default
- set a keyed value
INISED inifile section keyname=value
- delete a keyed value
INISED inifile section keyname=
- read an entire section
INISED inifile section
- delete an entire section
INISED inifile section=
Note, when "reading" values, they are written to the console, and thus may
be redirected to a file or another process using the standard operating system
redirection ("<",">") and pipe ("|") operators.
Batch operation
===============
There is one other significant mode of operation for INISED: using script files.
Invoking INISED with the command:
INISED @filename
will force INISED to read the file called "filename" and process the
file line by line, interpreting each line as a command. Commands use
the same syntax as above, but naturally drop the "INISED" prefix ie:
inifile section[= | keyname[= |=value | default]]
This mode allows a series of INI file manipulations to be collected as
a unit and stored in a file.
Embeeded spaces in parameters
=============================
Care is needed when paramters contain embedded spaces. Sections, keys
and values may all contain embedded spaces, as can INI file names under
OS/2. How should the program interpret the following?
INISED program.ini default settings initialposition
On the face of it, it means read the value of the key "settings" in the
"default" section, using "initialposition" as the default of no entry
actually exists. What was intended however, was to read the value of
"initialposition" in the "default settings" section. Hmmm.
The answer is to use either single or double quotation marks to
contain terms that have spaces within them. The following command
returns the value intended:
INISED program.ini "default settings" initialposition
All components of the command may be quoted to preserve embedded spaces:
section and key names, values and defaults, and INI file names. |
Aggiungi un commento