Switches

P7mTool is controlled through command line switches.

Long and short names

Switches have two forms: a short one , two-characters long eg. -ce , and a long one, with full switch name, eg. --EncryptTo. The short form is recognized by one dash and the long form by two dashes in front of the switch name. Letter case is not important, so --encryptto and --EncryptTo would be equivalent.

Switches values

Some switches have a value or multiple values, while others have no value. The value of a switch is given by appending the value to the switch name, either prepended with a space or directly after the switch name. The values are separated from each other by semicolon (;) or space. To provide a value with a space in it, sorround it with double quotation mark (").

NOTE: A space must be present after a quotation mark.

NOTE: To provide a multiline value, use "* syntax"

NOTE: To enter special characters or unicode characters, use variable evaluation.

"%p7mToolDir\p7mtool" -b64 -of smime.p7m
  -ce "alice.cer; ECA29B3F 1F7C09EB D4103B51 760992C7 FDC78672"
     -fl file1.txt file2.txt dir1
 

In the example above:

-b64 switch has no value
-of switch has one value : smime.p7m
-ce switch has two values : alice.cer, ECA29B3F 1F7C09EB D4103B51 760992C7 FDC78672
-fl switch has three values : file1.txt, file2.txt, dir1

Switch occurences

The same switch can be repeated in the switch list. Their consecutive values are attached to the value list in the order they appear in the command line. The order of their occurence will kept in the message, when this is meaningful, eg. in concatenating content, ordering certificates etc.
"%p7mToolDir%p7mtool" -hd -sgalice.cer -ofsmime.p7m
  -fl file1.txt -flfile2.txt -sgbob.cer
 

Importing switches

Groups of switches can be read from a file using --CommandFile switch. See --CommandFile switch for details and examples.

* Syntax

There are two basic ways of defining a switch's value:

  1. --SwitchName value1;value2;...;valueN

    The values value1 to valueN are added to the -par switch's values list.

    "%p7mToolDir%\p7mTool" --AddHeader "Content-Type: text/plain"


  2. --SwitchName *filepath1;...;filepathN

    The file/files content is added to the -par switch's values list.

    "%p7mToolDir%\p7mtool" -hr *headers.txt
     

    Note:
    If "* syntax" is used for the -cf switch value eg.p7mtool -cf*file.txt, consecutive values from file.txt file will be treated as names of files from which switches' values will be read.

    Note:
    To read a file's content as encoded Unicode string, use ${READ()} expression.

Copyright © Cryptigo 2001-2013Last modified on  09 Jul 2004