Resolving Variables in Non-INI Text Files

New Boundary Support
Packaging Tips

The information in this article applies to:

• Prism Deploy

• Prism Pack

• PictureTaker


Occasionally, a software installation process creates a non-INI formatted text file containing critical, user-specific information that the software needs in order to run correctly.  Some examples are the prefs.js file that is part of a Netscape Communicator installation, srvname.sql file that’s part of the installation of Microsoft SQL Server, and .ora files that are part of an Oracle database or client installation.  A method is needed to customize the Package so that when these text files are installed on a target system, they will be customized correctly for that user or computer.

Below is a section from an Oracle configuration file. As you can see, a specific computer name (karma) was captured when the Package was created. = (ORACLE_LISTENER,, (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = karma)(PORT = 1521))), (PROP=(

Instead of distributing the computer name “karma” to all recipients, you want the file to reference the name of the computer that is receiving the Package.


Prism (and PictureTaker) Smart Variables make this possible, but variables can’t be resolved in non-INI text files.  However, by using a free tool from Microsoft called Windows Scripting Host and scripts developed by New Boundary Technologies, there is a way to resolve variables in these types of files. Below is an example showing the need to insert a specific computer name in Oracle configuration files: Here are the steps:

1.      Create your Package as usual. All the text file names within the Package that have a specific computer name need to be marked for special handling in Prism’s rules.ini. file. To do this, first close the Editor. Then open the rules.ini file with Notepad and add the file names to the end of the “Text Files=” line in the [File Definitions] section. For example, here’s how you would edit rules.ini based on special text files contained in an Oracle Package:
Text Files=AUTOEXEC.BAT,CONFIG.SYS,services.ora
Close and save rules.ini.

2.      Re-open your Package in the Editor. Choose Edit | Replace. In “find what”, type in the specific computer name that was captured in the Package. In our example, this is karma. In “replace with” type in the variable %computername%. The name of the variable can be anything you choose as long as it’s enclosed in % signs. We’ve chosen “computername” for this example because NT/2000/XP have “computername” as a built-in system variable. In the “Find and Replace in” section, make sure all boxes are checked. Click the “Replace All” button, and all references to karma will be changed to %computername%.  Here’s what the edited services.ora file might look like:

Because we have used the built-in “computername” variable, we don’t have to do anything else. If we had used a variable named something else, for example “fred”, then we’d need to configure that variable in the Package. The steps are pictured below.

3.      NT/2000/XP systems:  Write a script that a) installs the Package (the variables will not be resolved in this step); b) converts the unresolved variables in the files to the unique computer name of each target system. This is done by calling our utility ExpFile.cmd (for NT/2000/XP) and telling it which text file to process. The syntax of the command is:
/Run /Wait \\server\share\ExpFile.cmd <path to file with unresolved variable>
Here’s a sample NT/2000/XP script:

4.      Windows Me and 9x systems:  Write a script that a) installs the Package (the variables will not be resolved in this step); b) converts the unresolved variables in the files to the unique computer name of each target system. You’ll need to use Windows Scripting Host, which is a free download available from Microsoft Corporation, along with the New Boundary Technologies file expfile.vbs. Note: Windows Me and 98 systems should already have Windows Scripting Host installed. The syntax of the command is:
/Run /Wait cscript.exe \\server\share\Prism\Utilities\expfile.vbs <path to file with unresolved variable>

Here’s a sample 9x script:

NOTE 1: The files used in this KB article can be downloaded from the Article Attachments section.

NOTE 2: Windows Scripting Host handles blank lines in a non-INI text file in a better manner than the command interpreter. We recommend the Visual Basic Script for situations that require exact parsing.



Also In This Category

On a scale of 1-5, please rate the helpfulness of this article

Not Helpful
Very Helpful
Optionally provide your comments to help us improve this article...

Thank you for your feedback!

Add Your Comments
Email Address:
RadEditor - HTML WYSIWYG Editor. MS Word-like content editing experience thanks to a rich set of formatting tools, dropdowns, dialogs, system modules and built-in spell-check.
RadEditor's components - toolbar, content area, modes and modules
Toolbar's wrapper  
Content area wrapper
RadEditor's bottom area: Design, Html and Preview modes, Statistics module and resize handle.
It contains RadEditor's Modes/views (HTML, Design and Preview), Statistics and Resizer
Editor Mode buttonsStatistics moduleEditor resizer
RadEditor's Modules - special tools used to provide extra information such as Tag Inspector, Real Time HTML Viewer, Tag Properties and other.
Verification Code:
Last Modified: 11 Years Ago
Last Modified By: New Boundary Support
Type: INFO
Article not rated yet.
Article has been viewed 4.7K times.
Customer Support Software By InstantKB 2015-2
Execution: 1.000. 9 queries. Compression Disabled.