Command-line switches for Microsoft Office products

When you launch a Microsoft Office product, the startup process runs in a standard way. Microsoft Word, for example, displays the Word splash screen and loads the Normal template. But suppose you want Word to start without its splash screen and then load a template other than the Normal template. Or, you want to customize the process even more by loading an add-in or running a macro upon startup. You can add options like this by using subcommands called command-line switches to an Office app's startup command.

If you want to use the customization just one time, you can type the command and switch in the Run dialog box (Start menu) in Microsoft Windows. If you want to use a particular switch many times or every time that you start the app, you can create a desktop shortcut that starts the program by using the same switch and parameters. This article describes how to do both. It also includes a table that lists all of the switches and parameters that are available in the desktop Office apps.

Using a command-line switch doesn't mean you have to type the whole startup command at the command prompt. You can start the Office app as usual, by clicking the program icon on the desktop, or by clicking the program name on the Start menu. All startup methods essentially do the same thing: they run the app's .exe file, even if you don't actually type the command or even see it.

A command-line switch is a modifier that is added to the .exe file. A startup file with a switch looks like this.

 outlook.exe /nopreview

In this example, a command-line switch has been added to the .exe file for Microsoft Outlook. The switch consists of a forward slash and a word or abbreviation that indicates the switch's action. This switch tells Outlook to launch without showing the Reading Pane.

A switch is sometimes followed by one or more specific instructions called parameters, which give the program further information about how to run the .exe command. For example, the following command tells Outlook to load a specific profile name upon startup.

outlook exe /profile profilename

Switch names cannot be abbreviated and are not case-sensitive. However, their parameters are sometimes case-sensitive.

Here are the names of the startup commands for the Office products Word, Excel, PowerPoint, PowerPoint viewer, Outlook, and Access.

Word

winword.exe

Excel

excel.exe

PowerPoint

powerpnt.exe

PowerPoint Viewer

pptview.exe

Outlook

outlook.exe

Access

msaccess.exe

When you use one of the Office startup commands, you must supply the full path to the product's .exe file. Verify the location of this file on your computer. This table shows the locations of the .exe files if you accepted the default folder locations during installation.

In Office 2007

Windows 32-bit: C:\Program Files\Microsoft Office\Office12\

Windows 64-bit: C:\Program Files (x86)\Microsoft Office\Office12\

In Office 2010

Windows 32-bit: C:\Program Files\Microsoft Office\Office14\

Windows 64-bit: C:\Program Files (x86)\Microsoft Office\Office14\

In Office 2013

Windows 32-bit: C:\Program Files\Microsoft Office\Office15\

Windows 64-bit: C:\Program Files (x86)\Microsoft Office\Office15\

In Office 2016

Windows 32-bit: C:\Program Files\Microsoft Office\Office16\

Windows 64-bit: C:\Program Files (x86)\Microsoft Office\Office16\

  1. In Windows 10, click the Search or Cortana icon in the taskbar, type Run, and then click Command Prompt in the results.

    In Windows 8, press the Windows key, type Run, and then press Enter.

    In Windows 7, click Start, point to All Programs, click Accessories, and then click Run.

  2. In the Run dialog box, type a quotation mark, enter the full path for the app's .exe file, and then type another quotation mark. Alternatively, click Browse to locate and select the file. In this case, the quotation marks are supplied automatically.

  3. After the closing quotation mark, type a space, and then type the switch. For example, you might type:

    "c:\program files\microsoft office\office15\outlook.exe" /nopreview
    

The next time you start the app, it opens as usual. To make your customized startup available for repeated uses, see the next section.

Note the following about using command-line switches:

  • You can use only one switch at a time. Starting an Office app with multiple switches is not supported.

  • If the parameter is a path to a location on your computer, or a file name with spaces in it, enclose it in double quotation marks—for example, /t "Monthly Report.dotx".

  • Switches and parameters are not case-sensitive. For example, /RO functions the same as /ro.

  • Include one blank space before each switch and one before each parameter.

  1. Right-click the Windows desktop, point to New, and then click Shortcut on the shortcut menu.

  2. In the Create Shortcut Wizard, in the Type the location of the item box, type a double quotation mark ("), enter the full path for the app's .exe file (including the file name), and then type another double quotation mark. (Alternatively, click Browse to locate and select the file. In this case, the quotation marks are added automatically.)

  3. Following the closing quotation mark, type a space, and then type the switch and any parameters. If the parameter is a path to a location on your computer, and the path contains a space, it also must be enclosed in quotation marks. For example:

    "c:\program files\microsoft office\office15\excel.exe" /r "c:\My Folder\book1.xlsx"
    
  4. Click Next.

  5. In the Type a name for this shortcut box, type a name for the shortcut, and then click Finish.

    The wizard creates the shortcut and places it on the desktop.

Whenever you want to use the shortcut to start the app, double-click it.

To add the desktop shortcut to the Windows Start menu, right-click the shortcut, and then click Pin to Start menu on the shortcut menu.

List of command-line switches for Office products

Each Office product has a different set of command-line switches.

Note: These lists don't include all switches added since Office 2007. If you use command-line switches and want information about newer switches that are available, please respond Yes or No to the "Was this information helpful" question at the end of this topic. Then, in the box that appears, tell us which Office product and version you're interested in.

Switch and parameter

Description

/safe

Starts Word in Safe Mode.

/q

Starts Word without displaying the Word splash screen.

/ttemplatename

Starts Word with a new document based on a template other than the Normal template.

Example    To start Word with a document based on a template called Myfax.dotx, stored on the C drive, type the following at the command prompt:

/tc:\Myfax.dotx

Note: Do not include a space between the switch and the name of the template file.

Security Note: Because templates can store macro viruses, be careful about opening them or creating files based on new templates. Take the following precautions: run up-to-date antivirus software on your computer, set your macro security level to high, clear the Trust all installed add-ins and templates check box, use digital signatures, and maintain a list of trusted sources.

/t filename

Starts Word and opens an existing file.

Example    To start Word and open the template file Myfax.dotx, stored on the C drive, type the following at the command prompt:

/t c:\Myfax.dotx

Example    To start Word and open multiple files, such as MyFile.docx and MyFile2.docx, each stored on the C drive, type the following at the command prompt:

/t c:\MyFile.docx c:\MyFile2.docx

/f filename

Starts Word with a new document based on an existing file.

Example    To start Word and create a new document based on file MyFile.docx, stored on the desktop, type the following at the command prompt:

/f "c:\Documents and Settings\All Users\Desktop\MyFile.docx"

/h http://filename

Starts Word and opens a read-only copy of a document that is stored on a Microsoft Windows SharePoint Services site. The site must be on a computer that is running Word 2007 or later or Windows SharePoint Services 2.0 or later.

Example    To start Word and open a copy of file MyFile.docx, stored in a document library at the URL http://MySite/Documents, type the following at the command prompt:

/h http://MySite/Documents/MyFile.docx

Note: If the document is checked out to you, the /h switch has no effect. Word opens the file so that you can edit it.

/pxslt

Starts Word and opens an existing XML document based on the specified Extensible Stylesheet Language Transformation (XSLT).

Example    To start Word and apply the XSLT MyTransform, stored on the C drive, to the XML file Data.xml, also stored on the C drive, type the following at the command prompt:

/pc:\MyTransform.xsl c:\Data.xml

/a

Starts Word and prevents add-ins and global templates (including the Normal template) from being loaded automatically. The /a switch also locks the setting files.

/ladd-in

Starts Word and then loads a specific Word add-in.

Example    To start Word and then load the add-in Sales.dll, stored on the C drive, type the following at the command prompt:

/lc:\Sales.dll

Note: Do not include a space between the switch and the add-in name.

Security Note: Use caution when running executable files or code in macros or applications. Executable files or code can be used to carry out actions that might compromise the security of your computer and data.

/m

Starts Word without running any AutoExec macros.

/mmacroname

Starts Word and then runs a specific macro. The /m switch also prevents Word from running any AutoExec macros.

Example    To start Word and then run the macro Salelead, type the following at the command prompt:

/mSalelead

Note: Do not include a space between the switch and the macro name.

Because macros can contain viruses, be careful about running them. Take the following precautions: run up-to-date antivirus software on your computer; set your macro security level to high; clear the Trust all installed add-ins and templates check box; use digital signatures; maintain a list of trusted publishers.

/n

Starts a new instance of Word with no document open. Documents opened in each instance of Word will not appear as choices in the Switch Windows list of other instances.

/w

Starts a new instance of Word with a blank document. Documents opened in each instance of Word will not appear as choices in the Switch Windows list of the other instances.

/r

Re-registers Word in the Windows registry. This switch starts Word, runs Office Setup, updates the Windows registry, and then closes.

/x

Starts Word from the operating system shell so that Word responds to only one Dynamic Data Exchange (DDE) request (for example, to print a document programmatically).

/ztemplatename

Visibly behaves exactly like the /t switch. However, you can use the /z switch with Word to generate both a Startup and a New event, whereas the /t switch generates only a Startup event.

Switch and parameter

Description

workbook path | file name

This parameter does not require a switch.

Starts Excel and opens the specified file.

Example

excel.exe "c:\My Folder\book1.xlsx"

or

excel.exe http://MySite/Book1.xlsx

/r workbook path | file name

Opens a specific workbook as read-only.

Example

excel.exe /r "c:\My Folder\book1.xlsx"

or

excel.exe /r http://MySite/Book1.xlsx

/t workbook path | file name

Starts Excel and opens the specified file as a template.

Example

excel.exe /t "c:\My Folder\book_name.xlsx".

or

excel.exe /t http://MySite/book_name.xlsx

/n workbook path | file name

Like /t, starts Excel and opens the specified file as a template.

Example

excel.exe /n "c:\My Folder\book_name.xlsx".

or

excel.exe /n http://MySite/book_name.xlsx

/e or /embed

Prevents the Excel startup screen from appearing and a new blank workbook from opening.

Example

excel.exe /e

/p workbook path

Specifies a folder as the active working folder (for example, the folder that is pointed to in the Save As dialog box).

Example

excel.exe /p "c:\My Folder"

/s or /safemode

Forces Excel to bypass all files that are stored in startup directories, such as the default XLStart folder located in the directory where Excel or Microsoft Office is installed.

Example

excel.exe /s

/m

Creates a new workbook that contains a single XLM macro sheet.

Example

excel.exe /m

/a progID

Starts Excel and loads the Automation add-in that is specified by the progID of the add-in.

Example

excel.exe /a MyProgId.MyProgID2.1

/x

Starts a new instance (a separate process) of Excel.

Example

excel.exe /x "c:\My Folder\book1.xlsx"

or

excel.exe /x http://MySite/Book1.xlsx

Here are the command-line switches that are available for PowerPoint.

Switch or parameter

Action

/B

Starts PowerPoint with a new blank presentation.

Example: "c:\program files\microsoft office\office12\POWERPNT.exe" /B

/C

Starts PowerPoint with the specified file open and also starts Microsoft Windows NetMeeting conferencing.

Example: "c:\program files\microsoft office\office12\POWERPNT.exe" /C NetMeetingPresentation.pptx

Note: If you use this switch without specifying a file, PowerPoint starts with no presentation open and NetMeeting conferencing is not started.

/EMBEDDING

Starts PowerPoint without displaying the Office PowerPoint 2007 program window. Developers use this switch when testing add-ins.

Example: "c:\program files\microsoft office\office12\POWERPNT.exe" /EMBEDDING

/M MACRO

Runs a macro in a specified presentation.

Example: "c:\program files\microsoft office\office12\POWERPNT.exe" /M myfile.pptm "MyMacro"

"MyMacro" is a macro in the file myfile.pptm.

/N

Starts PowerPoint and creates a new presentation.

Example: "c:\program files\microsoft office\office12\POWERPNT.exe" /N "Path\templatename.potx"

This example specifies the name of the template that the new presentation is based on: templatename.potx.

If a template name is not supplied, PowerPoint starts a new presentation based on the blank template (in effect, the same as using the /N switch without a template name).

/O

Starts PowerPoint and specifies a list of files to open.

Example: "c:\program files\microsoft office\office12\POWERPNT.exe" /O File name1.pptx, File name2.pptx

/P

Prints the presentation to the default printer by using default settings.

When you use the /P switch, PowerPoint displays the Print dialog box before printing. After you choose options and click OK, the dialog box closes, and PowerPoint prints the file and then closes. If you don't want to see PowerPoint at all, use the /PT (Print To) switch instead.

Example: "c:\program files\microsoft office\office12\POWERPNT.exe" /P "MyFile.pptx"

/PT

Prints the presentation to the specified printer by using the default settings.

If you don't want to see PowerPoint at all, use the /PT (Print To) switch.

Example: "c:\program files\microsoft office\office12\POWERPNT.exe" /PT "PrinterName" "" "" "MyFile.pptx"

PrinterName is the name of the printer that appears in the Name box under Printer in the Print dialog box. The empty quotation marks are necessary; the quotation marks around PrinterName and the path to the PPTX file are needed only if there are spaces in either of the names, but it is always a good idea to use them.

/PMO

Prints the specified file, but show the Print dialog box.

When you use the /P switch, PowerPoint displays the Print dialog box before printing. After you choose options and click OK, the dialog box closes, and PowerPoint prints the file and then closes. If you don't want to see PowerPoint at all, use the /PT (Print To) switch instead.

Example: "c:\program files\microsoft office\office12\POWERPNT.exe" /PMO "MyFile.pptx"

/RESTORE

Restores PowerPoint to the way it was before the program closed abnormally. When PowerPoint restarts, it will attempt to recover and restore some aspects of the state of the program and presentations before it closed.

Example: "c:\program files\microsoft office\office12\POWERPNT.exe" /RESTORE

/S

Opens the specified presentation file as a slide show.

Example: "c:\program files\microsoft office\office12\POWERPNT.exe" /S "Presentation1.pptx"

Here are the command-line switches that are available for PowerPoint Viewer.

Switch or parameter

Action

/D

Shows the Open dialog box when the presentation ends.

Example: "c:\program files\microsoft office\office12\PPTVIEW.exe" /D

/L

Reads a playlist of PowerPoint presentations contained within a text file.

Example: "c:\program files\microsoft office\office12\PPTVIEW.exe" /L "Your_Play_List.txt "

Note: The playlist file is a list of presentation file names (preceded by the path as needed). It is not possible to add additional command-line switches to the individual presentations within the playlist.

/N#

Opens the presentation at a specified slide number, instead of slide 1.

Example: "c:\program files\microsoft office\office12\PPTVIEW.exe" /N5 "Presentation.pptx"

This example opens Presentation.pptx at slide 5.

/S

Starts the viewer without showing the splash screen.

Example: "c:\program files\microsoft office\office12\PPTVIEW.exe" /S

/P

Sends the presentation to a printer, and print the file.

Example: "c:\program files\microsoft office\office12\PPTVIEW.exe" /P "Presentation.pptx"

This example prints the Presentation.pptx file.

Switch

Description

/a

Creates an item with the specified file as an attachment.

Example:

  • "c:\program files\microsoft office\office15\outlook.exe" /a "c:\my documents\labels.doc"

If no item type is specified, IPM.Note is assumed. Cannot be used with message classes that are not based on Outlook.

/altvba otmfilename

Opens the VBA program specified in otmfilename, instead of %appdata%\microsoft\outlook\vbaproject.otm.

/c messageclass

Creates a new item of the specified message class (Outlook forms or any other valid MAPI form).

Examples:

  • /c ipm.activity creates a Journal entry

  • /c ipm.appointment creates an appointment

  • /c ipm.contact creates a contact

  • /c ipm.note creates an e-mail message

  • /c ipm.stickynote creates a note

  • /c ipm.task creates a task

/checkclient

Prompts for the default manager of e-mail, news, and contacts.

/cleanautocompletecache

Removes all names and e-mail addresses from the Auto-Complete list. (Outlook 2013, 2016 only)

/cleancategories

Deletes any custom category names that you have created. Restores categories to the default names.

/cleanclientrules

Starts Outlook and deletes client-based rules.

/cleanconvongoingactions

Deletes the Conversations Actions Table (CAT). CAT entries for a conversation thread usually expire 30 days after no activity. The command-line switch clears all conversation tagging, ignore, and moving rules immediately stopping any additional actions. (Outlook 2013, 2016 only)

/cleandmrecords

Deletes the logging records saved when a manager or a delegate declines a meeting.

/cleanfinders

Resets all Search Folders in the Microsoft Exchange mailbox for only the first profile opened.

/cleanfromaddresses

Removes all manually added From entries from the profile.

/cleanmailtipcache

Removes all MailTips from the cache. (Outlook 2013, 2016 only)

/cleanreminders

Clears and regenerates reminders.

/cleanroamedprefs

All previous roamed preferences are deleted and copied again from the local settings on the computer where this switch is used. This includes the roaming settings for reminders, free/busy grid, working hours, calendar publishing, and RSS rules.

/cleanrules

Starts Outlook and deletes client-based and server-based rules.

Important If you have multiple or additional mailboxes in your Outlook profile, running the /cleanrules command line switch deletes the rules from all connected mailboxes. Therefore, it is recommended that you only run this command when your Outlook profile only contains the one, target mailbox.

/cleanserverrules

Starts Outlook and deletes server-based rules.

/cleansharing

Removes all RSS, Internet Calendar, and SharePoint subscriptions from Account Settings, but leaves all the previously downloaded content on your computer. This is useful if you cannot delete one of these subscriptions within Outlook 2013.

/cleansniff

Overrides the programmatic lockout that determines which of your computers (when you run Outlook at the same time) processes meeting items. The lockout process helps prevent duplicate reminder messages. This switch clears the lockout on the computer it is used. This enables Outlook to process meeting items.

/cleansubscriptions

Deletes the subscription messages and properties for subscription features.

/cleanweather

Removes city locations added to the Weather Bar.

/cleanviews

Restores default views. All custom views you created are lost.

/embedding

Used without command-line parameters for standard OLE co-create.

/f msgfilename

Opens the specified message file (.msg) or Microsoft Office saved search (.oss).

/finder

Opens the Advanced Find dialog box.

/hol holfilename

Opens the specified .hol file.

/ical icsfilename

Opens the specified .ics file.

/importNK2

Imports the contents of an .nk2 file which contains the nickname list used by both the automatic name checking and Auto-Complete features.

/importprf prffilename

Starts Outlook and opens/imports the defined MAPI profile (*.prf). If Outlook is already open, queues the profile to be imported on the next clean start.

/launchtraininghelp assetid

Opens a Help window with the Help topic specified in assetid displayed.

/m emailname

Provides a way for the user to add an e-mail name to the item. Only works together with the /c command-line parameter.

Example:

  • Outlook.exe /c ipm.note /m emailname

/nopreview

Starts Outlook with the Reading Pane off.

/p msgfilename

Prints the specified message (.msg).

/profile profilename

Loads the specified profile. If your profile name contains a space, enclose the profile name in quotation marks (" ").

/profiles

Opens the Choose Profile dialog box regardless of the Options setting on the Tools menu.

/promptimportprf

Same as /importprf except a prompt appears and the user can cancel the import.

/recycle

Starts Outlook by using an existing Outlook window, if one exists. Used in combination with /explorer or /folder.

/remigratecategories

Starts Outlook and starts the following commands on the default mailbox:

  • Upgrades colored For Follow Up flags to Outlook 2013 color categories.

  • Upgrades calendar labels to Outlook 2013 color categories.

  • Adds all categories used on non-mail items into the Master Category List

Note: This is the same command as Upgrade to Color Categories in each Outlook mailbox properties dialog box.

/resetfolders

Restores missing folders at the default delivery location.

/resetfoldernames

Resets default folder names (such as Inbox or Sent Items) to default names in the current Office user interface language.

For example, if you first connect to your mailbox in Outlook by using a Russian user interface, the Russian default folder names cannot be renamed. To change the default folder names to another language, such as Japanese or English, you can use this switch to reset the default folder names after you change the user interface language or install a different language version of Outlook.

/resetformregions

Empties the form regions cache and reloads the form region definitions from the Windows registry.

/resetnavpane

Clears and regenerates the Folder Pane for the current profile.

/resetquicksteps

Restores the default Quick Steps. All user-created Quick Steps are deleted.

/resetsearchcriteria

Resets all Instant Search criteria so the default set of criteria is shown in each module.

/resetsharedfolders

Removes all shared folders from the Folder Pane.

/restore

Attempts to open the same profile and folders that were open prior to an abnormal Outlook shutdown. (Outlook 2013, 2016 only)

/rpcdiag

Opens Outlook and displays the remote procedure call (RPC) connection status dialog box.

/rununittests

/safe

Starts Outlook without the Reading Pane or toolbar customizations. Both native and managed Component Object Model (COM) add-ins are turned off.

/safe:1

Starts Outlook with the Reading Pane off.

/safe:3

Both native and managed Component Object Model (COM) add-ins are turned off.

/select foldername

Starts Outlook and opens the specified folder in a new window. For example, to open Outlook and display the default calendar, use: "c:\program files\microsoft office\office15\outlook.exe" /select outlook:calendar.

/share feed://URL/filename

/share stssync://URL

/share web://URL/filename

Specifies a sharing URL to connect to Outlook. For example, use stssync://URL to connect a SharePoint list to Outlook.

/sniff

Starts Outlook, forces a detection of new meeting requests in the Inbox, and then adds them to the calendar.

/t oftfilename

Opens the specified .oft file.

/v vcffilename

Opens the specified .vcf file.

/vcal vcsfilename

Opens the specified .vcs file.

Switch

Parameter

Description

None

database

Opens the specified database or Microsoft Access project. You can include a path, if necessary. If the path contains spaces, enclose it in quotation marks.

/excl

None

Opens the specified Access database for exclusive access. To open the database for shared use in a multiuser environment, omit this switch. Applies to Access databases only.

/ ro

None

Opens the specified Access database or Access project for read-only use.

/runtime

None

Specifies that Access will start with runtime version options.

/profile

user profile

Starts Access by using the options in the specified user profile instead of the standard Windows Registry settings created when you installed Access. This replaces the /ini switch used in versions of Access prior to Access 95 to specify an initialization file.

/compact

target database or target Access project

Compacts and repairs the Access database, or compacts the Access project that was specified before the /compact switch, and then closes Access. If you omit a target file name following the /compact switch, the file is compacted to the original name and folder. To compact to a different name, specify a target file. If you include a path that contains spaces, enclose the path in quotation marks.

If you specify a file name in the target database or target Access project parameter but you don't include a path, the target file is created in the default database folder that is specified in Access. You can change this setting in the Access Options dialog box.

In an Access project, this option compacts the Access project (.adp) file but not the Microsoft SQL Server database.

/x

macro

Opens the Access database that was specified before the /x switch, and then runs the specified macro. Another way to run a macro when you open a database is to create a macro named AutoExec.

Macros can contain viruses, so you must be careful about running them. Take the following precautions: run up-to-date antivirus software on your computer; use the Trust Center to disable all macros except those that are digitally signed; maintain a list of trusted sources of macros.

/ cmd

None

Specifies that what follows on the command line is the value that will be returned by the Command function. This option must be the last switch on the command line. You can use a semicolon (;) as an alternative to /cmd.

Use this switch to specify a command-line argument that can be used in Visual Basic for Applications (VBA) code.

Connect with an expert
Contact us
Expand your skills
Explore training

Was this information helpful?

Thank you for your feedback!

Thank you for your feedback! It sounds like it might be helpful to connect you to one of our Office support agents.

×