Using meta chars

To use one of the OS/2 meta chars (e.g. |, <, >, ...) as normal, literal chars in OS/2 commands you can precede the meta char with a caret ^. This char, known as an "escape character", will keep the meta char from being interpreted by the shell.

Thus, whereas the meta char ">" normally will redirect output from a program or other source, the two characters "^>" will be seen by the system as ">" with no special meaning. This is one way in which you could execute the following command without producing an error:

 
  echo The objectID of the Connection folder is ^<WP_CONNECTIONSFOLDER^>.

To use a literal caret character you must use ^^.

The other method to use these chars as literal chars is to surround the whole string with double quotes ".

To prevent the CMD.EXE from interpreting the percent char % you can also use two of them: %%. That's also necessary if you want to use the percent char in a string enclosed in double quotes.

To use filenames beginning with a dash (-) wihtout having the system interpret the filenames as command parameters, use either the absolute path or a relative path in your command.

Example:

 
  attrib -r .\-test.log

  attrib -r c:\temp\-test.log

Note: Users of alternate command shells such as 4OS2 should check to see what char their command interpreter is using as the escape char (CMD.EXE uses "^") before using the caret symbol. Some command interpreters allow the user to change the character used. This is usually controlled by a setting in an INI file or environment variable.