Command-line switches for Microsoft Office products

Applies To
Excel for Microsoft 365 Word for Microsoft 365 Outlook for Microsoft 365 PowerPoint for Microsoft 365 Access for Microsoft 365 Excel 2024 Word 2024 Outlook 2024 PowerPoint 2024 Access 2024 Excel 2021 Word 2021 Outlook 2021 PowerPoint 2021 Access 2021

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.

About commands, switches, and parameters

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 selecting the program icon on the desktop, or by selecting 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 classic Outlook. The switch consists of a forward slash and a word or abbreviation that indicates the switch's action. This switch tells classic 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 classic Outlook to load a specific profile name upon startup.


outlook exe /profile profilename

In new Outlook, the method for specifying command-line switches is different. Instead of using a forward slash (/), you use two dashes (--). For example, the following command instructs new Outlook to load a specific profile name upon startup.

olk.exe --profile profilename

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

Startup command names and locations

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

Word winword.exe
Excel excel.exe
PowerPoint powerpnt.exe
PowerPoint Viewer pptview.exe
Classic Outlook outlook.exe
New Outlook olk.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 365, 2024, & 2021 Windows 32-bit: C:\Program Files (x86)\Microsoft Office\root\Office16\
Windows 64-bit: C:\Program Files\Microsoft Office\root\Office16\

The folder name where the new Outlook app is installed changes with each version update. It starts with Microsoft.OutlookForWindows_, ends with _8wekyb3d8bbwe, and includes the version number and machine architecture. For example: Microsoft.OutlookForWindows_1.2024.717.400_x64_8wekyb3d8bbwe

In new Outlook C:\Program Files\WindowsApps\Microsoft.OutlookForWindows_<Version>_<Architecture>_8wekyb3d8bbwe\olk.exe

To find the current version's install location, run the following PowerShell command: 

(Get-AppxPackage Microsoft.OutlookForWindows).InstallLocation

Use a switch once by adding it to the Run command

  1. In Windows, select Search in the taskbar, or press the Windows key, type Run, and then click Command Prompt in the results.

  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\root\office16\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.

Make a switch available for reuse by creating a shortcut

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

  2. In the Create Shortcut Wizard, 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 in the Type the location of the item box. 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\root\office16\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.

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.
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.
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.
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.