home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / inised10.zip / INISED.TXT
Text File  |  1994-12-18  |  6KB  |  178 lines

  1. INISED v1.0 - Utility to Manipulate Windows-style Profile (INI) files
  2. =====================================================================
  3. Copywrite (c) Paul Gallagher 1994.
  4. The author grants general permission to distribute and use this package,
  5. provide it remains complete as detailed in section (1), is not modified
  6. in any way, and is not sold for more than a reasonable media and
  7. distribution charge.
  8.  
  9. Contents of this file:
  10.   1. Package
  11.   2. Version History
  12.   3. Contacting the author
  13.   4. System Requirements
  14.   5. About INISED
  15.   6. Using INISED
  16.  
  17. 1. Package
  18. ==========
  19.  
  20.   INISED.TXT        = this file
  21.   DOS\INISED.EXE    = DOS executable
  22.   OS2\INISED.EXE    = OS/2 v2.x executable
  23.  
  24. 2. Version History
  25. ==================
  26.  
  27. 94.12.18 : v1.0 for DOS and OS/2. The OS/2 exe should run under NT,
  28.   but this hasn't been tested yet!
  29.  
  30. 3. Contacting the Author
  31. ========================
  32. Paul Gallagher:
  33. Contact me by mail at <paulg@resmel.bhp.com.au>
  34. tel: +61-3-566-1023 (BH Australian Eastern time).
  35.  
  36. 4. System Requirements
  37. ======================
  38. INISED requires DOS v3.x or higher, or OS/2 v2.0 or higher.
  39.  
  40. 5. About INISED
  41. ===============
  42. INISED is a command line utility (OS/2 and DOS versions included)
  43. that can read and write values to/from Windows-style profile
  44. files (INI files). It is intended to automate the reconfiguring
  45. of programs without the need to maintain multiple versions on INI
  46. files. INISED can manipulate files based on command line parameters,
  47. or can read a sequence of commands from a script file.
  48.  
  49. 6. Using INISED
  50. ===============
  51. (NB. DOS or OS2 versions operate identically)
  52.  
  53. Getting help:     INISED -?
  54.  
  55. First a bit about INI file terminology. The Windows Profile (INI)
  56. file format is text, whereas OS/2 support binary INI files. This
  57. utility does *not* support binary INI files, so the OS/2 format will
  58. not be discussed further.
  59.  
  60. In an INI file, we basically have a series of keyed definitions
  61. contained within application sections, as follows...
  62.  
  63.   [section]
  64.   keyname=value
  65.   keyname=value
  66.  
  67.   [section]
  68.   keyname=value
  69.  
  70. Obviously, actual section and key names should be unique.
  71.  
  72. INISED provides a means of reading and writing values to INI files
  73. based on the section and key. 
  74.  
  75. Each INISED command provides a selection of the following information:
  76.  
  77.   . INI file name
  78.   . section name
  79.   . key name
  80.   . value
  81.   . default
  82.  
  83. The INISED can take all of this information on a command line. For example,
  84. the following command issued at the DOS prompt will read the value of the
  85. key called "shell" in the "boot" section of the SYSTEM.INI file:
  86.  
  87.   INISED system.ini boot shell
  88.  
  89. the following command is used to set the key to a new value:
  90.  
  91.   INISED system.ini boot shell=appbar
  92.  
  93. This example demonstrates the purpose of INISED quite well: say you wanted
  94. to use the boot configuration manager in DOS 6 and higher to create 2
  95. system configurations: one that brought Windows up with the standard
  96. Program Manager, and a personal config that used AppBar as the Windows
  97. shell. You could create two SYSTEM.INI files, and have the AUTOEXEC.BAT
  98. file copy the appropriate file into the Windows directory at boot, but what
  99. about preserving changes that may have been made to the file, by installing
  100. some new software for example. You could go through the laborious process
  101. of migrating SYSTEM.INI modifications to your "master" INI files, but
  102. this is not very practical. The easier solution is to use INISED to modify the
  103. "shell" specification in situ: use it to modify the *current* SYSTEM.INI
  104. file, thus preserving any modification made since you established your 
  105. multiple configurations.
  106.  
  107.    Command line operations
  108.    =======================
  109. So, what are the range of commands that you can give INISED? There
  110. are a few, but most are based on the common syntax...
  111.  
  112.   INISED inifile section[= | keyname[= |=value | default]]
  113.  
  114. in the above, [] brackets enclose optional entries (and are not to be entered
  115. as part of the command, and the | character seperates alternatives.
  116.  
  117. If we expand the command into all its permutations, we get:
  118.  
  119.  - read a keyed value
  120.      INISED inifile section keyname
  121.  
  122.  - read a keyed value, with default
  123.      INISED inifile section keyname default
  124.  
  125.  - set a keyed value
  126.      INISED inifile section keyname=value
  127.  
  128.  - delete a keyed value
  129.      INISED inifile section keyname=
  130.  
  131.  - read an entire section
  132.      INISED inifile section
  133.  
  134.  - delete an entire section
  135.      INISED inifile section=
  136.  
  137. Note, when "reading" values, they are written to the console, and thus may
  138. be redirected to a file or another process using the standard operating system
  139. redirection ("<",">") and pipe ("|") operators.  
  140.  
  141.    Batch operation
  142.    ===============
  143. There is one other significant mode of operation for INISED: using script files.
  144. Invoking INISED with the command:
  145.  
  146.   INISED @filename
  147.  
  148. will force INISED to read the file called "filename" and process the
  149. file line by line, interpreting each line as a command. Commands use
  150. the same syntax as above, but naturally drop the "INISED" prefix ie:
  151.  
  152.   inifile section[= | keyname[= |=value | default]]
  153.  
  154. This mode allows a series of INI file manipulations to be collected as
  155. a unit and stored in a file.
  156.  
  157.    Embeeded spaces in parameters
  158.    =============================
  159. Care is needed when paramters contain embedded spaces. Sections, keys
  160. and values may all contain embedded spaces, as can INI file names under
  161. OS/2. How should the program interpret the following?
  162.  
  163.    INISED program.ini default settings initialposition
  164.  
  165. On the face of it, it means read the value of the key "settings" in the
  166. "default" section, using "initialposition" as the default of no entry
  167. actually exists. What was intended however, was to read the value of
  168. "initialposition" in the "default settings" section. Hmmm.
  169.  
  170. The answer is to use either single or double quotation marks to
  171. contain terms that have spaces within them. The following command
  172. returns the value intended:
  173.  
  174.    INISED program.ini "default settings" initialposition
  175.  
  176. All components of the command may be quoted to preserve embedded spaces:
  177. section and key names, values and defaults, and INI file names.
  178.