/CHECK and /CHECKALL
/SEND and /SENDALL
/IMPORT
/EXPORT
/FOCUS
/MAIL
mailto:
/ADD
/OP
/DEDUPIGNOREMSGID, /DEDUPIGNORETOMSGID, /DEDUPIGNORETO and /DEDUPIGNOREDATE
/BATCH
/LDIFIMPORT and /LDIFEXPORT
/REFILTER
/MINIMIZE, /MIN, /EXIT, /SMARTEXIT, /NOLOGO and others
What is a Command Line
The command line is a text string that is passed to the system whenever a program is executed. It contains the path to the program, followed by a set of parameters. To start a program in Windows, you can either use the Start menu "Run" command, or click on the program’s shortcut on the desktop or in the Start menu. If you start a program by clicking its shortcut, you can edit the command line in the properties of this shortcut. Right-click the shortcut, select “Properties” and under “Shortcut” change the command line in the “Target” field.
For The Bat!, the command line in a Shortcut looks like this:
"C:\Program Files (x86)\The Bat!\thebat32.exe" or "C:\Program Files\The Bat!\thebat64.exe"
You can add some start-up parameters to the command line to define a set of actions performed whenever you start the program. For example, you can switch off the The Bat! start-up logo by adding the /NOLOGO parameter:
"C:\Program Files (x86)\The Bat!\thebat32.exe" /NOLOGO
Using The Bat! command line parameters from batch files and other programs
It is possible to use The Bat! from batch files or other programs meaning that you are able to automatically send and receive emails.
For example, to send two email messages, run the following sequence of commands from a batch file, provided that the current directory is "C:\Program Files\The Bat!\thebat64.exe":
thebat64.exe /MAILTO=recipient1@ritlabs.com;SUBJECT=Test;TEXT=c:\test\test1.txt
thebat64.exe /MAILTO=recipient2@ritlabs.com;SUBJECT=Test;TEXT=c:\test\test2.txt
This example demonstrates using the /MAIL command line parameter for automated message creation.
Following is the description of all command line parameters that The Bat! supports.
Checking Mail - /CHECK and /CHECKALL
/CHECK can be used as a command line parameter whenever you want to check mail for one or more accounts.
/CHECKALL is used for checking mail for all accounts and exiting from The Bat! if there were no new messages received. It is a simplified form of the /CHECK* /SMARTEXIT combination.
Syntax
/CHECK<account mask1>[;account mask2[;account mask3[...]]]
The account mask is used to identify which accounts to perform the check operation for. It can be:
Note: To separate account masks, use semicolons (";" character). Do not use spaces between account masks, because a space-separated mask will be interpreted as the start of the next command line parameter and will not be processed as intended.
If a mask contains space characters, enclose it in quotation marks. If a mask contains quotation marks, you should use single quotes (" ' " character).
- Account name. Example: /CHECK"Account 1";"Account 2". Thus, The Bat! will check new mail for the accounts “Account 1” and "Account 2" (note that quotation marks are not included into account names - they are used only because the names contain space characters)
- The beginning of an account name ending with an asterisk (* sign). Example: to check new mail for all accounts with names starting with the word "My", use /CHECKmy*
- Asterisk followed by the end of an account name. Example: /CHECK*1 will check new mail for all accounts with names ending with "1"
- A name fragment surrounded by asterisks. Example: /CHECK*account* will check all accounts with the word "account" in their name
- An asterisk, which means that all accounts will be checked
Sending Mail - /SEND and /SENDALL
The /SEND command can be used as a command line parameter for The Bat!, whenever you want to send all queued mail from one or more accounts.
The /SENDALL command is used for sending queued mail from all accounts and exiting from The Bat!, if there were no queued messages. It is a simplified form of the /SEND* /SMARTEXIT combination.
Syntax
/SEND<account mask1>[;account mask2[;account mask3[...]]]
The account mask is used to identify the accounts to perform the send operation for. It can be:
- Account name. Example: /SEND"Account 1";"Account 2". The Bat! will send queued mail from the accounts “Account 1” and “Account 2” (note that quotation marks are not included into account names - they are used only because the names contain space characters)
- The beginning of an account name ending with an asterisk (* sign). Example: to send queued mail from all accounts with names starting with the word "My", use /SENDmy*
- Asterisk followed by the end of an account name. Example: /SEND*1 will send queued mail from all accounts with names ending with "1"
- A name fragment surrounded by asterisks. Example: /SEND*account* to send mail from all accounts with the word "account" in their name
- An asterisk which means that queued mail will be sent from all accounts
Importing Messages - /IMPORT
The /IMPORT command allows to import messages to a specified folder from RFC-822 message files or from UNIX mailbox files.
Syntax
/IMPORT[parameter1[;parameter2[;parameter3[...]]]
Possible Parameters
Parameter | Description |
USER=value or U=value | Account name. If no FOLDER parameter is specified, the destination folder will be the Inbox of the given account |
PASSWORD=value or P=value | The password which will unlock the account if it is needed |
FOLDER=value or F=value | The pathname of the destination folder. If the pathname does not include an account name, The Bat! will search all accounts for a folder with a matching name. If the specified folder is not found, the Inbox folder of the destination account is used |
UNIX or X | This parameter tells The Bat! that the input files are in UNIX mailbox format. By default, input files are treated as separate RFC-822 messages |
READ or R | When this parameter is used, all imported messages will be marked as read (by default, all imported messages are marked as unread) |
FILE=value or IN=value or INFILE=value or I=value | A file mask with the pathname for the input files. The /IMPORT command can have an unlimited number of such parameters |
DELETE or DEL or W | If this parameter is specified, all files processed will be deleted once they have been successfully imported |
Examples
/IMPORTU="Account 1";FOLDER="Friends\Sam";IN=C:\Inbox\Sam\*.MSG
/IMPORTF="\\Account 1\Business\Unsorted";UNIX;FILE=C:\Inbox\Unsorted\*.mbox;READ
Exporting Messages and Addresses - /EXPORT
The /EXPORT command allows to export messages from a specified folder to RFC-822 message files or UNIX mailbox files. This command also allows the export of address book entries if the LDIF parameter is specified.
Syntax
/EXPORT[parameter1[;parameter2[;parameter3[...]]]
Possible parameters
Parameter | Description |
USER=value or U=value | Account name. If no FOLDER parameter is specified, the destination folder will be the Inbox of the given account |
PASSWORD=value or P=value | The password which will unlock the account if it is needed |
FOLDER=value or F=value | The pathname of the source folder. If the pathname does not include an account name, The Bat! will search all accounts for a folder with a matching name. If the specified folder is not found, the Inbox folder of the source account is used |
DIR=value or D=value or OUT=value or O=value | The pathname for the output directory (for RFC-882 messages) or for the output path and file name (for UNIX mailbox). If RFC-822 format is chosen, the exported messages are stored in the output directory in files sequentially named xxxxxxxx.MSG (each "x" character corresponds to a digit from 0 to 9). When the export starts, The Bat! calculates the starting xxxxxxxx number and, in the the event when such files are found, the output file names will begin immediately after the greatest number found |
UNIX or X | This parameter tells The Bat! that the output file will be in UNIX mailbox format (by default, output files are in RFC-822 message format) |
READ or R | When this parameter is used, only read messages are exported. By default, all messages are exported |
UNREAD or N | When this parameter is used, only unread messages are exported |
REPLIED or RE | When this parameter is used, only replied messages are exported |
UNREPLIED or NR | When this parameter is used, only non-replied messages are exported |
PARKED or PR | When this parameter is used, only parked messages are exported |
UNPARKED or UP | When this parameter is used, only non-parked messages are exported |
MAXAGE=value or AGE=value or A=value | Specifies the maximum age (in days) of messages to be exported. If the age of a message exceeds the specified maximum age, the message will not be exported |
START=value or S=value | Specifies the number of the starting message in the source folder. All messages located before the starting message will not be exported. If a negative value is given, the starting message number is calculated by subtracting the positive value from the number of messages in a folder, for example, if -5 is specified, that means that the export will start from the fifth message from the end of the message base |
END=value or E=value | Specifies the number of the final message in the source folder for the export operation. All messages located after this final message will not be exported. If a negative value is given, the last message number is calculated by subtracting the positive value from the number of messages in the folder, for example, if a value of -2 is given, this means that the export will end at the second message from the end of the message base |
OVERRIDE or V | If this parameter is specified (used with UNIX or LDIF parameters), The Bat! will overwrite the output file if it already exists. By default, The Bat! adds new messages to the end of the mailbox file |
DELETE or DEL or W | All messages processed will be deleted at the end of a successful export operation |
LDIF | If this parameter is specified, an address export in LDIF will be performed |
ADDRESSBOOK=value or AB=value or BOOK=value | A name, filename or the full path of the address book which should be exported (used with the LDIF parameter). If no address book is specified, The Bat! uses the default address book |
GROUP=value or G=value | The handle of the address book group which should be exported (used with the LDIF parameter). If no address book is specified, The Bat! will search all address books for the first group whose name matches the specified handle |
Examples
/EXPORTU="Account 1";F="Friends\Sam";DIR=C:\Inbox\Sam\;S=-20
/EXPORTF="\\Account 1\\Unsorted";UNIX;O=C:\Unsorted\Mail.mbx;UNREAD
/EXPORTLDIF;AB="Address book 1";Group="My group";O="C:\MyGroupFile.LDIF"
/EXPORTLDIF;Group="Friends";O="C:\Friends.LDIF"
Focusing on a Folder - /FOCUS
The /FOCUS command allows you to automatically focus on a specified folder in the main window.
Syntax
/FOCUS[parameter1[;parameter2[;parameter3[...]]]
Possible Parameters - (a parameter may be identified by two or more names):
Parameter | Description |
USER=value or U=value | The name of the source account. If no FOLDER parameter is specified, the target folder will be the Inbox of the given account |
PASSWORD=value or P=value | The password which will unlock the account if it is needed |
FOLDER=value or F=value | The pathname of target folder. If the pathname does not include an account name, The Bat! will search all accounts for a folder with a matching name. If the specified folder is not found, the Inbox folder of the target account is used |
Examples
/FOCUSU="Account 1";F="Friends\Sam"
/FocusF="\\My account\New mail";P=mypass
Automated Message Creation - /MAIL
The /MAIL command is used for automated message creation using a template, text file and attachments for a specified address.
Syntax
/MAIL[parameter1[;parameter2[;parameter3[...]]]
Parameter | Description |
USER=value or U=value | Account name. If no FOLDER parameter is specified, the target folder will be the Outbox of the given account |
PASSWORD=value or P=value | Access password for this account if needed |
FOLDER=value or F=value | The pathname of the target folder. If the pathname does not include an account name, The Bat! will search all accounts for a folder with a matching name. If the specified folder is not found, the Outbox folder of the target account is used |
TEMPLATE=value or T=value | The pathname of the file which contains the template that will be used for this message. The standard template of the target folder or account is used by default |
TO=value | First recipient’s email address. You can add additional recipients using the %TO, %CC or %BCC macros in the template |
SUBJECT=value or S=value | Message subject. You can specify the subject using the %SUBJECT macro in the template |
TEXT=value or CONTENTS=value or C=value | The pathname of a plain text file which contains the text of the message. It is also possible to include a text file into a message using the %PUT macro in the template |
ATTACH=value or FILE=value or A=value | The pathname of the file which will be attached to the message. It is also possible to use the %ATTACHFILE macro in the template to attach a file |
SEND | If this parameter is used, the created message will be sent as soon as it has been created |
QUEUE | If this parameter is used, the created message will be queued in the Outbox folder once it is created |
EDIT | If this parameter is used, The Bat! opens the editor with the message created using the specified parameters |
Examples
/MAILU=MyAccount;TO=john.doe@ritlabs.com;S=Test;TEXT=C:\TEST\TEST.MSG
/MAILF=\\MyAccount\Test;TO=john.doe@ritlabs.com
Message Creation - mailto:
The mailto: command is used to open a new editor window in The Bat! using pre-set parameters.
mailto: is the standard Internet URL for publishing email addresses which is described in RFC 2368. This command line parameter can be used by browsers that need to open an email editor when the user clicks on a link which contains a mailto: URL.
Creating New Account –/ADD
The /ADD command allows to create new accounts. All parameters correspond to account settings.
Syntax
/ADD:[parameter1 [;parameter2 [;parameter3 [...]]]
Parameter | Description |
User=value | Account name |
InServer=value | The incoming mail server address (POP3 or IMAP4) |
OutServer=value | The outgoing mail server address (SMTP) |
InUser=value | User name at the incoming mail server |
InPassword=value | Password to access the mailbox |
OutUser=value | User name at the outgoing mail server (if it differs from the user name specified for the incoming mail server) |
OutPassword=value | Password at the outgoing mail server (if it differs from the user name specified for the incoming mail server) |
TLS or IMAPTLS or POPTLS | Sets the “Secure to dedicated port (TLS)” connection type for POP/IMAP (regular connection type is used by default) |
SendTLS or SMTPTLS | Sets the „Secure to dedicated port (TLS)” connection type for SMTP (regular connection type is used by default) |
StartTLS or IMAPStartTLS or POPStartTLS | Sets the “Secure to regular port (STARTTLS)” connection type for POP/IMAP (regular connection type is used by default) |
SendStartTLS or SMTPStartTLS | Sets the „Secure to regular port (STARTTLS)” connection type for SMTP (regular connection type is used by default) |
REGULAR | Sets the regular connection type for POP/IMAP |
SMTPREGULAR | Sets the regular connection type for SMTP |
NOSMTPAUTH | Disables SMTP Authentication (RFC 2554) (SMTP Authentication is enabled by default) |
SMTPAUTH | Enables SMTP Authentication (RFC 2554) if it was disabled |
Combined | Enables the “combined delivery (send+receive)” option |
Deferred | Sets the deferred delivery type |
IMAP | Sets the IMAP4 protocol for this account, otherwise the POP3 protocol will be used |
FileDir[="attachment directory"] | Enables the “Keep attachment files separately in a special directory” option. If the directory is not specified, the program uses the default directory to keep attachments |
Template="value" | The default new message template for this account stored in a file |
ReplyTemplate="value" | The default reply template for this account stored in a file |
ForwardTemplate="value" | The default forward template for this account stored in a file |
KeepDays=value | The period during which messages will be kept on the server |
DelReceived | Enables the “Delete received messages from server” option. By default, messages are left on the server |
DelTrashServer | Enables the “Delete message from server when it is removed from Trash” option |
SizeLimit=value | The maximum size of a message in Kbytes |
FromAddr=value | The From email address |
FromName=value | The From name |
ReplyAddr=value | The Reply-To email address |
ReplyName=value | The Reply-To name |
PortPOP=value | Port number for POP (if it is non-standard) |
PortSMTP=value | Port number for SMTP(if it is non-standard) |
PortIMAP=value | Port number for IMAP (if it is non-standard) |
Password=value | The password which unlocks the account if it is needed |
Example (write in a single line without space characters)
/ADD; User="john"; InServer="pop3.example.com"; OutServer="smtp.example.com"; InUser="john"; InPassword="johnpass"; FromAddr="john.doe@ritlabs.com"; FromName="John Doe"; ReplyAddr="john.doe@ritlabs.com"; ReplyName="John Doe"
Folder Maintenance - /OP
The /OP command is used to carry out folder maintenance.
Syntax
/OP:<parameter1>:<parameter2>:<argument>
Possible parameters
Parameter | Description |
COMPRESS | Compacts a folder |
PURGE | Purges old/exceeding messages |
KILLDUPES | Removes duplicates |
CLEARCACHE | Clears cache |
EMPTY | Empties a folder |
Possible arguments
Argument | Description |
ACCOUNT NAME | Account name |
FULL PATH TO FOLDER | Full path to the specified folder |
Examples
/OP:COMPRESS:Andrew
/OP:KILLDUPES:PURGE:COMPRESS:"\\My Account\Inbox"
Note: You can use several parameters, but only one argument.
Deleting Duplicates – /DEDUPIGNOREMSGID, /DEDUPIGNORETOMSGID, /DEDUPIGNORETO and /DEDUPIGNOREDATE
/DEDUPIGNOREMSGID, /DEDUPIGNORETOMSGID, /DEDUPIGNORETO and /DEDUPIGNOREDATE are independent parameters that can be used for removing duplicates.
By default, duplicates share the same Message-ID, sender (From), recipient (To) and date (Date). Messages are considered duplicates if these four attributes coincide, the other attributes are not taken into account. If two messages have different message bodies, however Message-ID, From, To and Date fields coincide, the program will delete one of these messages if you use the “remove duplicates” command.
If messages do not have Message-IDs, the program checks the subjects (Subject) instead.
If you use the /DEDUPIGNOREMSGID parameter, Message-ID is not checked, the program checks the From, To, Date and Subject fields.
If the /DEDUPIGNORETOMSGID parameter is used, both Message-ID and recipient’s address are not checked, meaning that the program compares only sender’s address, date and subject. If the Date header is missing, the program checks the Received date.
Use the /DEDUPIGNORETO parameter to check for duplicates by Message-ID, sender and date while ignoring the recipient.
By executing the /DEDUPIGNOREDATE parameter the program will ignore messages' creation date and look for the duplicates with equal Message-ID, sender and recipient.
Execution of Several Commands from a File - /BATCH
/BATCH allows executing multiple commands defined in a text file (each command being placed in one line).
Syntax
/BATCH:<filepath>
For example, if you want to check your account and send queued mail from it, you can create a batch file C:\The Bat!\CheckMail.BAT which contains the following lines:
/CHECKMyAccount
/SENDMyAccount
/SMARTEXIT
To execute this batch file from a command line, you can run The Bat! with the command line parameter /BATCH:“C:\The Bat!\CheckMail.BAT”
Exporting and Importing Address Book or Group in LDIF-file –/LDIFIMPORT and /LDIFEXPORT
Syntax
/ldifexport:[parameter1[:parameter2[:parameter3[...]]]
/ldifimport:[parameter1[:parameter2[:parameter3[...]]]
Parameter | Description |
AB, B, BOOK, ADDRBOOK, ADDRESSBOOK = address book name | The name of the address book that should be exported or imported |
G, AG, GROUP = group name | The name of the address book group that should be exported or imported |
FILE = file name | The name of the file for export or import |
OUT = file name | The name of the file for export (used instead of FILE) |
IN = file name | The name of the file for import (used instead of FILE) |
Examples
thebat32.exe /lidfexport:ab="Main book":file="c:\exported\main.ldif"
thebat64.exe /lidfimport:ab="Imported":in="c:\exported\main.ldif"
You can additionally use the /LDIFNOUTF command to disable UTF-8 encoding.
Sorting Messages –/REFILTER
The /REFILTER command is used for re-filtering a folder.
Syntax
/REFILTER[parameter1[;parameter2[;parameter3[...]]]
Parameter | Description |
FOLDER=value or F=value | The pathname of the folder that will be re-filtered |
INCOMING or IN | If this parameter is used, the program uses filters for Incoming mail to re-filter the folder |
OUTGOING or OUT | If this parameter is used, the program uses filters for Outgoing mail to re-filter the folder |
READ or RD | If this parameter is used, the program uses filters for Read messages to re-filter the folder |
REPLIED or RP | If this parameter is used, the program uses filters for Replied messages to re-filter the folder |
MANUALONLY or MANUAL | If this parameter is used, the program uses manual filters only |
Example
/REFILTER;F="\\Account\My Folder";IN;REPLIED
Other commands - /MINIMIZE, /MIN, /EXIT, /SMARTEXIT, /NOLOGO and other
/EXIT
The /EXIT command is used to close The Bat! as soon as all mail transfer operations are complete.
/SMARTEXIT
The /SMARTEXIT command is used to close The Bat! as soon as all mail transfer operations are complete, but only if no new messages were received.
/MINIMIZE
The /MINIMIZE command minimizes The Bat! to the Task Bar or to the System Tray if the respective option under Options -> Preferences -> General is enabled.
/MIN
The /MIN command minimizes The Bat! to the Task Bar or to the System Tray if the respective option under Options -> Preferences -> General is enabled.
/NOLOGO
The /NOLOGO command disables the start-up screen that appears on program’s start-up. When it is used in the command line, The Bat! logo will not be displayed while program is loading its data.
/OPEN
Using the /OPEN command you can open a message or a vCard from a file (VCF/MSG/EML) in a separate window.
Syntax
/OPEN:file name
Example: thebat32.exe /OPEN:"c:\My Data\message.eml"
/MSGID
Using the /MSGID command you can view the needed message in a separate window. You should indicate the Message-ID of this message.
Syntax
/MSGID:Message-ID
Example: thebat64.exe /msgid:1234567890.20060202085723@mail.com
If The Bat! does not find the message in the current folder, the program will offer to select a folder for searching. If you know the folder where the message is kept, you can either use the /FOCUS command or indicate its Message-ID and use the FOLDER parameter.
Examples: thebat32.exe /FocusF="\\\General\ABC Folder"/msgid:1234567890.20060202085723@mail.com
or thebat32.exe /msgid:1234567890.20060202085723@mail.ru?folder="\\\General\ ABC Folder"
Note:
The pathname of a common folder should be specified using the following format: \\\CommonFolder\path\name\folder
The pathname of a folder should be specified using the following format: \\AccountName\path\name\folder
/CARDFILE
The /CARDFILE command allows to send submission forms.
Syntax
/CARDFILE"file name"
/TERMINATE
The /TERMINATE command closes The Bat! even if there are active sessions in the queue.
/REG
Using the /reg:<name> command you can launch The Bat! from different registry key (the name of the key consists of The Bat!+<name>). For example, if you launch The Bat! using the /reg:test parameter, the key The Bat!test will be created in the Registry, and you will be able to set up The Bat! anew.
/DontWriteEmailEnvironmentVariable
You can configure The Bat! not to specify the %EMAIL% variable by running it with the /DontWriteEmailEnvironmentVariable command line parameter, or by setting the DWORD DontWriteEmailEnvironmentVariable variable to 1 under HKEY_CURRENT_USER\Software\RIT\The Bat!
/DECRYPT_FILE_OTFE
If you add this command line parameter and start The Bat! with the encrypted database, the program will prompt you to select a file from within the mail database, then it will save the decrypted copy of the selected file (adding .decrypted) in the same directory and terminate.
|