Page updated 24 August 2009
Introduction
Some programs can accept "Command Line Options", that control how it behaves as it is launched. These options, sometimes referred to as "switches" are added to the command that is associated with the program's icon on the Desktop or Start Menu. It is also possible to start a Program directly with a command line entered in the Run dialogue, accessed from the Start Menu. The switches are simply added at the end of the command.
nPOPuk responds to a number of switches that enable it to be started:
- And automatically check for incoming mail, closing any pre-existing nPOPuk session
- With a designated Mailbox active
(By default, the first Mailbox is always the active one on launch.) - From any platform, accessing the same set of Mailboxes
(Assumes that multiple platform-dependent versions of nPOPuk are installed on a single Flash Drive or similar portable device.) - With data loaded from a private area of the disk
(Useful where a single user's data needs to be kept private and multiple users' separate.) - With a complete, or partially complete, new mail ready to send.
- And automatically send a predefined message
You need to be careful when entering command line options as there is a strict syntax to follow.
All examples below assume that nPOPuk is installed in "C:\Program Files\nPOPuk\nPOPuk.exe", unless otherwise stated. Your nPOPuk may be installed in other locations, just substitute the actual location where your nPOPuk program is installed.
An Icon Property Dialogue
If you have created a Desktop Shortcut or Start Menu option as described on the Installation page, you should then be able right-click on that item and, from the menu that appears, select "Properties" to reveal a dialogue similar to that on the right.
The line marked "Target:" contains the command line. By default, this will simply show the name of the program file and its location within the filing system, all enclosed in double quotes. This is sufficient to tell the computer which program is to be launched and where to find it. Command line options may be added to the "Target:" line to alter the behaviour of the shortcut. You may choose to make copies of the shortcut and have different command line options in each one.
The Run Dialogue
Command lines can also be entered in the dialogue that appears when the "Run..." option is selected from the main Start Menu. If you don't want to clutter your Start Menu or Desktop with a range of rarely used, but difficult to remember commands, then this can be a useful approach, as the Run dialogue includes a history of previously used commands that can be selected from a drop down list.
The Command Shell
Command on older versions of Windows
The command shell is called "COMMAND.COM" on older versions of Windows (95, 98, ME). It can generally be found as a shortcut called "MS-DOS Prompt" on the Start Menu, in the Programs menu or the Accessories submenu. Alternately, you can start one in the Run dialogue by using the command "Command".
CMD on newer versions of Windows
The command shell is called "CMD.EXE" on newer versions of Windows (NT, 2000, XP, Vista). It can generally be found as a shortcut called "Command Prompt" on the Start Menu, in the Programs or All Programs menu, or the Accessories submenu. Alternately, you can start one in the Run dialogue by using the command "cmd".
Typing commands at the command shell prompt
Command lines can be entered within the command shell window at the prompt, and terminated with the Enter key.
Syntax of command line options
Command line options are case insensitive, so may be typed in any combination of uppercase and lowercase letters. Options must be separated from the program name and from each other by at least one space. There are four types of command line options:
- Option name
- The option name is given after a '/' character, such as '/opt' for option 'opt'
- Option name and value
-
The option name is preceded by a '/' and followed by a ':'; the value follows, either immediately or after some white space. The value should be enclosed in quotation marks if it contains white space or characters that might otherwise be interpreted by Windows (particular ones to note are "<>|&^"). Some examples of option names and values for an option named "vopt" and a corresponding value of "value" would be:
-
/vopt:value
-
/vopt:"value"
-
/Vopt: value
-
/vOpT: "value"
-
- email address
- If the command line contains a value not preceded by an appropriate option name, and not starting with "Mailto:", it is considered an email address, and an implicit "To" option is assumed to precede it.
- Mailto: URL option
- This option accepts a mailto: URL described by RFC 2368, restricted to the following list of headers: To, Cc, Bcc, Reply-To, Subject, Body, and extended with Attach. Although in versions of nPOPuk prior to 2.10 it was the only way to specify some options on the command line, with version 2.10 and beyond, the other slightly longer syntaxes are much more convenient to type. It continues to work as before, for use with invocations by browsers, and compatibility with saved command lines. It must appear as the last option on the command line when it is used. You should convert any such command lines to use the new syntax; future versions of nPOPuk may enforce more strict adherence to the RFC to be able to correctly support browser invocations. This will mostly affect the use of punctuation and non-ASCII characters.
Check for New Mail
To launch nPOPuk and have it check for mail and then quit add "/q" (without the quotes) to the command line.
NOTES:
1. For this option to function as described above, the Global Option Check mail on start must be set.
2. If there is an instance of nPOPuk already running, this option will close the existing nPOPuk session and neither instance will check for new mail.
"C:\Program Files\nPOPuk\nPOPuk.exe" /q
Launch with Designated Mailbox Active
To launch nPOPuk with a specified Mailbox active, rather than the default (first) Mailbox, add " /Mailbox:mbox" (without the quotes) to the command line, where "mbox" is the name of the Mailbox to be made active on launch. e.g. to launch nPOPuk and immediately select a Mailbox called "Work Mail", use the command line:
"C:\Program Files\nPOPuk\nPOPuk.exe" /Mailbox: "Work Mail"
An alternate form of this option is " /a:mbox". The option name "a" was in use prior to the "Mailbox" name, but the latter is clearer.
Select Config File
NOTE: Almost anything that can be done with this option can be better done with a "redirecting" nPOPuk.ini file (see next section, Redirecting Config File).
By default, on launch, nPOPuk looks for a file in the program folder called "nPOPuk.ini". This contains details of the user's data (Mailboxes, address book, etc). If it is not found nPOPuk assumes this is a new installation and behaves accordingly, requesting details of the first account to be created. This information is then written to a new "nPOPuk.ini" file created in the same folder as the program file itself. Alternately, a different file may be specified with the "config" option:
"C:\Program Files\nPOPuk\nPOPuk.exe" /y: "config.txt"
The data in the "nPOPuk.ini" file is synchronized with the Mailbox data in the nPOPuk Mailbox and Savebox files. Yet Windows, during a system restore, will sometimes (it varies between versions of Windows and exactly where the nPOPuk.ini file is placed) restore the nPOPuk.ini file but not the Mailbox and Savebox files. System restore may a good reason to exit all other applications before installing new ones. You can make nPOPuk immune to system restore, by renaming the file to something else. "config.txt" is recommended, as in the example above.
However, when nPOPuk is installed in "C:\Program Files" on modern versions of Windows, Microsoft recommends keeping the data in the user's Profile, rather than in the "C:\Program Files" folder. This can be done by using one of the handy Environment variables Windows creates together with the "config" option. The example shows placing the data in the hidden "Application Data" folder, in a sub-folder named "nPOPuk". Note that the quotation marks around the "config" value are probably necessary, as the %APPDATA% environment variable is likely to contain spaces when it are expanded.
"C:\Program Files\nPOPuk\nPOPuk.exe" /y: "%APPDATA%\nPOPuk\config.txt"
Redirecting Config File
By default, on launch, nPOPuk looks for a file in the program folder called "nPOPuk.ini". This contains details of the user's data (Mailboxes, address book, etc). If it is not found nPOPuk assumes this is a new installation and behaves accordingly, requesting details of the first account to be created. This information is then written to a new "nPOPuk.ini" file created in the same folder as the program file itself. Alternately, a redirecting "nPOPuk.ini" file can be created with a text editor, containing as the top or only line:
IniFile="config.txt"
The data in the "nPOPuk.ini" file is synchronized with the Mailbox data in the nPOPuk Mailbox and Savebox files. Yet Windows, during a system restore, will sometimes (it varies between versions of Windows and exactly where the nPOPuk.ini file is placed) restore the nPOPuk.ini file but not the Mailbox and Savebox files. System restore may a good reason to exit all other applications before installing new ones. You can make nPOPuk immune to system restore, by renaming the file to something else. "config.txt" is recommended, as in the example above.
However, when nPOPuk is installed in "C:\Program Files" on modern versions of Windows, Microsoft recommends keeping the data in the user's Profile, rather than in the "C:\Program Files" folder. This example shows placing the data in the hidden "Application Data" folder, in a sub-folder named "nPOPuk", by creating a redirecting "nPOPuk.ini", containing as the top or only line:
IniFile="%APPDATA%\nPOPuk\config.txt"
NOTES:
1. This redirecting config file is better than the "y" option because it doesn't require setting up a shortcut; on the Windows CE platform shortcuts are not something a user is expected to do; and even if they find software to do it, shortcuts must contain fully qualified paths to the program, which is hard to do for a flash card that might be called something different on different devices.
2. Anything after the first line in a redirecting "nPOPuk.ini" file is ignored, but this fact should not be used, to allow for potential future features.
Portability of nPOPuk
Consider the possibility of storing all varieties of nPOPuk and all your email data on a flash memory card and using it on any device that is supported. This can be achieved with a folder structure similar to the following. Instead of carrying around your own device or computer, or in case yours breaks, you could borrow any device that is supported by nPOPuk, and use it as a temporary measure.
Create a folder to hold all of your email and all versions of nPOPuk, perhaps called "Email", but it can be whatever name you like. Within that folder create a folder called "Data" for your Mailboxes and Saveboxes. Also within that folder create an additional folder for each platform supported by nPOPuk. For example:
/Data - Containing nPOPuk.ini, Address.lst, SendBox.dat and all MailBoxXX.dat files
/Platform1 - Containing platform specific nPOPuk.exe and required DLLs.
/Platform#... - Further platform specific folders containing the required EXE and DLL files.
Within each platform specific folder create a redirecting "nPOPuk.ini" file, containing the following line:
IniFile="..\Data\nPOPuk.ini"
To use nPOPuk on any device, use Windows Explorer or the file manager of the device to locate the "Email" folder; within that, choose the platform folder that corresponds to the device you are using; launch the nPOPuk.exe contained within that folder. The same email files
NOTES:
1. The "..\" sequence means go up one level from the current folder. Using this "relative addressing" means that it won't matter what drive letter or card name is assigned when the card is inserted in the device, nor does it matter what the top level folder is named.
2. If you have accounts that require the use of SSL, the appropriate SSL files should be placed in each platform folder.
3. If you use devices with small RAM size, be sure to keep your auto-loaded Mailboxes and Saveboxes small enough for the constraints of the device.
Launch for a Specific User
On a typical installation, users will have installed nPOPuk in a sub-folder of the "Program Files" folder called "nPOPuk". By default a user's data will be placed in that same folder. This is not best practice and many users will want to move their data to an area of the disk that is not accessible by others. This can be achieved as in the second example of the section Redirecting Config File.
Launch with Predefined E-Mail
It is possible, with command line options, to cause nPOPuk to launch with most, or even all, elements of an e-mail predefined, and ready to send or save. The instructions for this are given in the sub-sections below.
NOTE: An additional command line option must be used to send a predefined message on launch.
Here is a set of all the available options, and examples of use. Most of them correspond directly to a specific email header, and don't need particular explanation.
- To
-
/To: nobody@gmail.com
- Cc
-
/Cc: "nobody.else@gmail.com"
- Bcc
-
/Bcc: unseen.nobody@gmail.com
- Reply-To
-
/Reply-To: not.me@gmail.com
- Subject
-
/Subject: "Not much to say"
- Attach
-
/Attach: "c:\temp\comic-strip.gif"
The "Attach" option allows attaching files to the message to be composed. The filename specified should be fully qualified, or relative to the nPOPuk's DataFileDir. - Body
-
/Body: "But have a laugh..."
The "Body" option allow a small amount of text to be created for the message. Perhaps a short SMS message, or a short explanation of the attached file. There are some limitations with this option:
- The maximum length of the command line is the limiting factor on many platforms, particularly older versions of Windows.
- When this option is used the signature option for the account is ignored
- All the text appears on a single line (possibly wrapped into a single paragraph).
Due to these limitations, consider using the "Paste from file..." option in the edit window to add body, once the other options have been specified on the command line. While not fully automated, if the file is prepared in advance, the whole email can thus be composed extremely quickly in this manner.
Finding any of the above options will cause nPOPuk to begin composition of a new message after initializing.
Here are some examples of using multiple options to create a message.
Multiple Option Examples
The examples below are split over several lines but when entered on the command line should be entered as a single line. In these examples, <nPOPuk> needs to be replaced by the full path and file name enclosed in quotes:
<nPOPuk> /to: user@domain.com /subject: "Bug Report" /bcc:self@home.com /attach: a:\image.gif /mailbox:"nPOPuk Mail"
<nPOPuk> /Subject="Bug Report" /reply-to=me@work.com /bcc: self@home.com /mailbox: "Personal Mail" /body: "Here is my report:"
Launch and Send Predefined Message
To send a predefined message (constructed with other command line options) as nPOPuk is launched, add " /s" (without the quotes) to the command line, e.g. use the command line:
<nPOPuk> /To: user@domain.com /subject: "Bug Report" /bcc: self@home.com /attach: a:\image.gif /mailbox: "nPOPuk Mail" /s