Edit-OemText

This command is specifically designed for ASCII/ANSI files and can be used to insert or delete multiple lines. The command only works with wildcards when deleting. There are no restrictions on the use of wildcards as there are in the CMD shell. In addition to the file name, which must be specified in any case, further entries depend on the selected action.


Settings:

  • File
    File to be changed. The use of variables is possible. Use the "..." button to select an existing file (on the packaging system) or enter the path manually.
  • Action
    Specifies the action to be performed on file.
    • Insert line at the beginning of file
      Inserts the lines specified in text at the beginning of the file.
    • Add line to end of file
      Appends the lines specified in text to the end of the file.
    • Insert line in alphabetically ordered position
      Sorts the lines specified in text alphabetically into the file.
    • Delete line from exisiting file
      Deletes the lines specified in text from the file.
  • Options
    • Insert only lines that are not in the existing file
      Inserts only those lines that are not yet present in the existing file.
    • Replace existing lines in the existing file
      Existing lines in the existing file are overwritten.
    • Replace existing line
      Overwrites the specified line with text.
    • Insert lines whether they are already there or not
      Always inserts the lines, regardless of whether they already exist.
  • Use 32-Bit mode on x64 computer
    If the script is executed on a 64-bit operating system, the counterpart for 32-bit applications SysWOW64 can be used automatically when referring to the SYSTEM32 directory.
  • This file has the syntax of a TCP/IP configuration file
    Using this option you can specify the structure of the file. 

    TCP/IP configuration files have the following format:
    ip      0     IP       # Internet Protocol 
    icmp     1     ICMP     # Internet Control Message Protocol 
    This file has the unique key (=index column) in column 2. The format is taken into account in the comparison as follows:
    • Comments including # are removed.
    • As described above, the line is freed from unnecessary spaces, tabs are replaced by spaces.
    • The lines are checked for identity.
    • If the line is the same, the operation for this new line is considered complete.
    • If it is not the same, the system also compares whether the column specified as index column matches and then proceeds according to the overwrite option.

      Example:
      Existing line 1: icmp     1     ICMP     # Internet Control Message Protocol 
      New line:        newprot  1     NEW      # New Internet Protocol .
  • Use Unicode character set (UTF-16)
    Specifies that the file to be modified should be saved in Unicode format.
  • Text
    Text to be inserted or deleted.


Example:

Insert the following lines in file C:\Windows\System32\Drivers\Etc\Protocol

udp      17    UDP      # User Datagram Protocol
hmp     20    HMP      # Host Monitoring Protocol

Column 2 (values: 17 and 20) is checked whether the lines already exist. If applicable, they are overwritten.


Corresponds to DSM eScript command:

  • ModifyOemEx


See also: