How is a text file used as input for an operation in the Command Line Interface? (NETIQKB372)

  • 7700372
  • 02-Feb-2007
  • 20-Jun-2007


Directory and Resource Administrator 6.x

Directory and Resource Administrator 7.x

How is a text file used as input for an operation in the Command Line Interface?

The Command Line Interface (CLI) can conveniently accept a text file as input for processing. The text file usually contains a list of objects such as user accounts or groups and, when combined with a Directory and Resource Administrator (DRA) command, can provide a powerful timesaving method for processing a large number of objects.
The following examples illustrate the use of a FOR statement from the command line. For more information regarding command line syntax, please refer to the operating system documentation and on-line help. The text file should list the objects to be processed one after another, each on a new line.
This first example is a general command showing common syntax as well as variables to be modified as needed.

for /f  tokens=1 delims=  %1 in (c:\full path and name of file) do ea command %1 verb options

For the second example, assume the text file contains a list user accounts whose passwords are expired. The file is named AcctNames.txt and it is located on the root of the local C: drive. In order to modify each of the user accounts to set their passwords as NOT expired, the EA command below takes the file as input and combines it with the appropriate CLI syntax.

for /f  tokens=1 delims=  %1 in (c:\acctnames.txt) do ea user %1 update passwordexpired:n

NOTE: To use a CLI command referencing a text file within a batch file, the %1 variable must be modified to %%1 to be interpreted correctly.


Additional Information

Formerly known as NETIQKB372