Command Line Parameter Changes in Outlook

As part of SP3 for Outlook 2003 (and included in SP1 for Outlook 2007) we’ve made a change to the way command line parameters are parsed to ensure Outlook is always doing the right thing.  As part of this change, a less common way of attaching files to new e-mail messages through command line parameters with Outlook may be broken in some solutions.

Previously, Outlook under some circumstances would handle an implicit command line parameter without a switch. For example, if a command line argument was provided without a switch, and was a path to a folder in the file system, Outlook would treat the argument with an implicit /select switch flag, displaying that folder in the Explorer window.  If the argument was a path to a file on the file system, Outlook would use an implicit /a switch and attach the file to a new message.

As part of making sure that our command line parameters were handled in a predictable manner, we removed the implicit logic in these service packs.  You must now explicitly specify the appropriate switch before the path to a folder to display or file to attach.  If a solution calls Outlook using an argument without a switch or with an invalid set of switches, the following error is displayed:


For more information on the valid command line switches that are supported by Outlook, take a look at our online documentation for command line switches.

There are a few applications that I’m aware of that have already run into this problem.  I wanted to blog about it and make sure everyone knew what was going on and how to fix a solution that no longer works as expected. Command line parameters should always be preceded by a command line switch specifying what to do with the parameter.

Edit: This change was included as part of Outlook 2007 RTM, not just SP1 as I originally stated.

Comments (5)

  1. Simon Morrish says:

    Hi Ryan

    I have a problem with Outlook command lines since SP3.

    We use shortcuts to open the different folders. Prior to SP3, command lines like the following worked OK:

    "C:Program FilesMicrosoft OfficeOFFICE11OUTLOOK.EXE" /folder outlook:calendar /recycle

    This now gives the "The command line argument is not valid. Verify the switch you are using" error. I’ve added the /select switch as follows:

    "C:Program FilesMicrosoft OfficeOFFICE11OUTLOOK.EXE" /folder /select outlook:calendar /recycle

    …but still get the same error. I’ve found I can use /folder and /recycle on their own, or /select on its own, but not all three together.

    This is no good for me. I want shortcuts to open the existing outlook instance to a specific folder. How can I now achieve this?



  2. Bob says:

    Hi Ryan,

    I’m writing an application that is a library of PDF documents. The UI has buttons that allow the user to open an Outlook message with the selected PDF(s) automatically attached. It works fine for single attachments but I can’t find a way to programmatically open one email message with multiple attachments.

    The command line I’m using is: <full path to outlook> /c ipm.note /m “?subject=Requsted Forms from Human Resources” <full path to PDF>

    BTW: As far as I can tell /m and /a are mutually exclusive which forces us to rely on implicit attachment when the /m switch is invoked. Am I missing something?


  3. rgregg says:

    Hi Bob:

    Since you’re writing an application, I’d recommend you use Outlook COM object model or Simple MAPI to automate the process of creating a new mail item and attaching multiple files to the message.

    Because of changes in Outlook 2003 SP3 and later, you can no longer combine /m and /a, even when the /a is implied. Writing OM or SMAPI code to automate this will work better and be more reliable than using command line parameters.

  4. rgregg says:


    Unfortunately the scenario you are attempting is just broken in SP3. If your solution can be adapted to use the Outlook OM to display a new explorer on a particular folder, I would recommend taking that approach.  If that isn’t an option, then please contact Microsoft support to report the issue and optionally request a fix.