Word command line commands

Excel for Microsoft 365 Word for Microsoft 365 Outlook for Microsoft 365 PowerPoint for Microsoft 365 Access for Microsoft 365 Excel 2021 Word 2021 Outlook 2021 PowerPoint 2021 Access 2021 Excel 2019 Word 2019 Outlook 2019 PowerPoint 2019 Access 2019 Excel 2016 Word 2016 Outlook 2016 PowerPoint 2016 Access 2016 Excel 2013 Word 2013 Outlook 2013 PowerPoint 2013 Access 2013 Excel 2010 Word 2010 Outlook 2010 PowerPoint 2010 Access 2010 Excel 2007 Word 2007 Outlook 2007 PowerPoint 2007 Access 2007 More…Less

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 (x86)Microsoft OfficeOffice12

Windows 64-bit: C:Program FilesMicrosoft OfficeOffice12

In Office 2010

Windows 32-bit: C:Program Files (x86)Microsoft OfficeOffice14

Windows 64-bit: C:Program FilesMicrosoft OfficeOffice14

In Office 2013

Windows 32-bit: C:Program Files (x86)Microsoft OfficeOffice15

Windows 64-bit: C:Program FilesMicrosoft OfficeOffice15

In Office 2016 
& Office 2019

Windows 32-bit: C:Program Files (x86)Microsoft OfficeOffice16

Windows 64-bit: C:Program FilesMicrosoft OfficeOffice16

In Office 365

Windows 32-bit: C:Program Files (x86)Microsoft OfficerootOffice16

Windows 64-bit: C:Program FilesMicrosoft OfficerootOffice16

  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 filesmicrosoft officeoffice15outlook.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 filesmicrosoft officeoffice15excel.exe" /r "c:My Folderbook1.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 SettingsAll UsersDesktopMyFile.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 Folderbook1.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 Folderbook1.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 Folderbook_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 Folderbook_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 Folderbook1.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 filesmicrosoft officeoffice12POWERPNT.exe» /B

/C

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

Example: «c:program filesmicrosoft officeoffice12POWERPNT.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 filesmicrosoft officeoffice12POWERPNT.exe» /EMBEDDING

/M MACRO

Runs a macro in a specified presentation.

Example: «c:program filesmicrosoft officeoffice12POWERPNT.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 filesmicrosoft officeoffice12POWERPNT.exe» /N «Pathtemplatename.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 filesmicrosoft officeoffice12POWERPNT.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 filesmicrosoft officeoffice12POWERPNT.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 filesmicrosoft officeoffice12POWERPNT.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.

/PWO

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 filesmicrosoft officeoffice12POWERPNT.exe» /PWO «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 filesmicrosoft officeoffice12POWERPNT.exe» /RESTORE

/S

Opens the specified presentation file as a slide show.

Example: «c:program filesmicrosoft officeoffice12POWERPNT.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 filesmicrosoft officeoffice12PPTVIEW.exe» /D

/L

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

Example: «c:program filesmicrosoft officeoffice12PPTVIEW.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 filesmicrosoft officeoffice12PPTVIEW.exe» /N5 «Presentation.pptx»

This example opens Presentation.pptx at slide 5.

/S

Starts the viewer without showing the splash screen.

Example: «c:program filesmicrosoft officeoffice12PPTVIEW.exe» /S

/P

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

Example: «c:program filesmicrosoft officeoffice12PPTVIEW.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 filesmicrosoft officeoffice15outlook.exe» /a «c:my documentslabels.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%microsoftoutlookvbaproject.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.

Examples:

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

  • Outlook.exe /c ipm.note /m user@contoso.com?subject=Test&body=Hello

/noextensions

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

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

/resettodobar

Clears and regenerates the To-Do Bar task list for the current profile.

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

/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 filesmicrosoft officeoffice15outlook.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.

Need more help?

Microsoft Word

Статья создана 28.03.2020

При запуске продукта Microsoft Office его загрузка выполняется в стандартном режиме. Microsoft Word, например, отображает экран-заставку Word и загружает шаблон «Обычный». Однако предположим, что вы хотите запустить Word без экрана-заставки, а затем загрузить другой шаблон. Кроме того, вам может потребоваться загрузить надстройку, запустив макрос. Для этого можно добавить подкоманды (которые называются переключателями командной строки) в команду запуска приложения Office.

Если вы хотите использовать такие настройки всего один раз, вы можете ввести команду и переключатель в диалоговом окне Выполнить (меню «Пуск») в Microsoft Windows. Если же нужно использовать один и тот же переключатель несколько раз или каждый раз при запуске приложения, можно создать на рабочем столе ярлык, с помощью которого вы сможете запускать программу, используя одни и те же переключатели и параметры. В этой статье описаны оба этих метода, а также приведена таблица, содержащая все переключатели и параметры, доступные для классических приложений Office.

Сведения о командах, ключах и параметрах для Microsoft Word

Для использования кюча (переключателя) вовсе не нужно вводить всю команду запуска в командной строке. Вы можете запустить приложение Office как обычно, щелкнув значок на рабочем столе или название программы в меню Пуск. Все способы запуска фактически делают одно и то же: они запускают EXE-файл приложения, даже если вы не вводите саму команду или не видите ее.

Ключ (переключатель) командной строки представляет собой модификатор, который добавляется к EXE-файлу. Файл загрузки с переключателем выглядит следующим образом:

outlook.exe /nopreview

В этом примере переключатель командной строки добавлен к EXE-файлу Microsoft Outlook. Он включает в себя косую черту и слово или аббревиатуру, которые указывают на его действие. Данный переключатель позволяет отключить область чтения в Outlook.

Иногда за переключателем следуют отдельные инструкции, которые называются параметрами. Они предоставляют программе дополнительные сведения о том, как следует выполнять команду. Например, следующая команда позволяет загрузить определенный профиль при запуске Outlook:

outlook exe /profile profilename

Имена переключателей нельзя сокращать, но в них не учитывается регистр. Однако параметры иногда вводятся с учетом регистра.

Команды запуска и пути к Microsoft Office

Word — winword.exe

Excel — excel.exe

PowerPoint — powerpnt.exe

PowerPoint — pptview.exe

Outlook — outlook.exe

Access — msaccess.exe

ри использовании одной из команд запуска Office необходимо указать полный путь к EXE-файлу продукта. Прежде всего определите расположение файла. В этой таблице указано, где находятся EXE-файлы, если при установке вы решили использовать стандартные папки.

В Office 2007

32-разрядный выпуск Windows: C:Program FilesMicrosoft OfficeOffice12
64-разрядный выпуск Windows: C:Program Files (x86)Microsoft OfficeOffice12

В Office 2010

32-разрядный выпуск Windows: C:Program FilesMicrosoft OfficeOffice14
64-разрядный выпуск Windows: C:Program Files (x86)Microsoft OfficeOffice14

В Office 2013

32-разрядный выпуск Windows: C:Program FilesMicrosoft OfficeOffice15
64-разрядный выпуск Windows: C:Program Files (x86)Microsoft OfficeOffice15

В Office 2016

32-разрядный выпуск Windows: C:Program FilesMicrosoft OfficeOffice16
64-разрядный выпуск Windows: C:Program Files (x86)Microsoft OfficeOffice16

Однократное использование переключателя путем его добавления к команде «Выполнить»

a. В Windows 10 щелкните значок поиска или Кортаны на панели задач, введите Выполнить и щелкните Командная строка в результатах поиска.

На компьютере с Windows 8 нажмите клавишу Windows, введите команду Выполнить и нажмите клавишу ВВОД.

В Windows 7 нажмите кнопку Пуск и выберите пункты Все программы, Стандартные, Выполнить.

b. В диалоговом окне Выполнить введите прямые кавычки и внутри них укажите полный путь к EXE-файлу приложения или нажмите кнопку Обзор для поиска данного файла. В этом случае кавычки подставляются автоматически.

c. После закрывающей кавычки введите пробел, а затем переключатель, например:

«c:program filesmicrosoft officeoffice15outlook.exe» /nopreview

При следующем запуске приложения программа откроется как обычно.

Ограничения переключателей командной строки для Microsoft Word

Одновременно можно использовать только один переключатель. Запуск приложения Office с несколькими переключателями не поддерживается.

Если параметром является путь к расположению на вашем компьютере или имя файла с пробелами, заключите его в двойные кавычки (например, вот так: /t «Ежемесячный отчет.dotx»).

В переключателях и параметрах регистр не учитывается. Например, «/RO» работает так же, как «/ro».

Не забывайте вводить пробел перед каждым переключателем и параметром.

Параметр

Описание

/safe

Запуск Word в безопасном режиме.

/q

Запуск Word без вывода экрана-заставки.

/ttemplatename

Запуск Word с новым документом, который основан не на шаблоне — обычный.

Пример: Чтобы запустить Word с документом, который основан на шаблоне Myfax.dotx, хранящемся на диске C, введите следующую команду:

/tc:Myfax.dotx

Примечание: Не добавляйте пробел между переключателем и именем файла шаблона.

/t filename

Запуск Word и открытие существующего файла.

Пример Чтобы запустить Word и открыть шаблон Myfax.dotx, хранящийся на диске C, введите следующую команду:

/t c:Myfax.dotx

Пример Чтобы запустить Word и открыть несколько файлов, например шаблоны MyFile.docx и MyFile2.docx, хранящиеся на диске C, введите следующую команду:

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

/h http://filename

Запуск Word и открытие предназначенной только для чтения копии документа, который хранится на сайте Microsoft Windows SharePoint Services. Сайт должен размещаться на компьютере с Word 2007 или более поздней версии и Windows SharePoint Services 2.0 или более поздней версии.

Пример Чтобы запустить Word и открыть копию файла MyFile.docx, хранящегося в библиотеке документов по URL-адресу http://MySite/Documents, введите следующую команду:

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

/pxslt

Запуск Word и открытие существующего XML-документа, основанного на указанном преобразовании Запуск Word и открытие существующего XML-документа, основанного на указанном преобразовании Запуск Word и открытие существующего XML-документа, основанного на указанном преобразовании XSLT.

Пример Чтобы запустить Word и применить преобразование XSLT MyTransform, хранящееся на диске C, к XML-файлу Data.xml, также хранящемуся на диске C, введите следующую команду:

/pc:MyTransform.xsl c:Data.xml

/a

Запуск Word и предотвращение автоматической загрузки надстроек и глобальных шаблонов (включая шаблон «Обычный»). Переключатель /a также блокирует файлы параметров.

/ladd-in

Запуск Word и загрузка определенной надстройки.

Пример. Чтобы запустить Word и загрузить надстройку Sales.dll, хранящуюся на диске C, введите следующую команду:

/lc:Sales.dll

/m

Запуск Word без выполнения макросов AutoExec.

/mmacroname

Запуск Word и выполнение определенного макроса. Переключатель /m также запрещает запуск <>макросов AutoExec.

Пример. Чтобы запустить Word и выполнить макрос Salelead, введите следующую команду:

/mSalelead

/n

Запуск нового экземпляра Word без открытия документа. Документы, открытые в экземпляре Word, не будут отображаться в списке Перейти в другое окно других экземпляров.

/w

Запуск нового экземпляра Word с пустым документом. Документы, открытые в экземпляре Word, не будут отображаться в списке Перейти в другое окно других экземпляров.

/r

Повторная регистрация Word в реестре Windows. Этот переключатель запускает Word, вызывает мастер установки Office, обновляет реестр Windows, а затем закрывает мастер.

/x

Запуск Word из оболочки операционной системы. При этом Word отвечает только на один запрос динамического обмена данными (DDE) (например, для печати документа программным путем).

Примечание

Не добавляйте пробел между переключателем и именем файла шаблона.

Если документ извлечен вами, переключатель /h не действует. Файл открывается в Word, и вы можете изменить его.

Соблюдайте осторожность при запуске исполняемых файлов и программ в макросах и приложениях. С их помощью могут выполняться действия, способные нарушить безопасность компьютера и данных на нем.

Так как макросы могут содержать вирусы, соблюдайте осторожность при их запуске. Используйте следующие меры предосторожности: обновляйте антивирусную программу; задайте для макросов высокий уровень безопасности; снимите флажок Доверять всем установленным надстройкам и шаблонам; используйте цифровые подписи; ведите список надежных издателей.

Источник

Microsoft.com

Download PC Repair Tool to quickly find & fix Windows errors automatically

Microsoft Word has several useful command-line switches that can be used to start Word. These switches can be used to make Word run in a specific way or perform specific tasks – like if you want to start it in the Safe Mode without any addons.

To open a Word document using the switches in Windows 10/8/7, type winword.exe /x. Here “/x” is the switch.

To modify how Microsoft Office Word starts on a one-time basis, you can add switches to the Microsoft Windows Run command (Start menu).

The following is the list of switches for Microsoft Word:

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

If you plan to use a modified startup method frequently, you can create a shortcut on the Windows desktop, using these switches.

You can get the command line switches for Word, Excel, PowerPoint, Outlook and Access here at KB210565.

Ezoic

Anand Khanse is the Admin of TheWindowsClub.com, a 10-year Microsoft MVP (2006-16) & a Windows Insider MVP (2016-2022). Please read the entire post & the comments first, create a System Restore Point before making any changes to your system & be careful about any 3rd-party offers while installing freeware.

Rob van der Woude's Scripting Pages

A collection of

and arguments to control some program executables

On this page I will collect command line switches for some program executables.
This will make it easier to create reliable «quick-and-dirty» batch files to perform common tasks like printing, file conversion, etcetera without the need to dig into the program’s COM object details.

Most programs open a file if its full path is specified on the command line without any switches.
Most files’ «Open», «Print» and «PrintTo» commands can be found in the registry under HKEY_CLASSES_ROOT, or by examining file associations, the others may require some web searching, or even reading software manuals. 😉

Command line switches for:

  • Microsoft Access
  • Acronis TrueImage Home
  • Adobe Reader
  • AVG Antivirus
  • CDBurnerXP
  • Canon’s Digital Photo Professional
  • Excel
  • Mozilla Firefox
  • Foxit Reader
  • Internet Explorer
  • IrfanView
  • ISOWriter
  • Macrium Reflect
  • MagicISO
  • Nero Burning ROM
  • Notepad
  • OpenOffice
  • PowerPoint
  • PowerPoint Viewer
  • Corel Presentations
  • Corel Quattro Pro
  • Microsoft RAW Image Viewer
  • Mozilla Thunderbird
  • Sunbelt VIPRE Antivirus + Antispyware
  • Visio
  • Microsoft Word
  • Wordpad
  • WordPerfect
  • Microsoft XPS Viewer
  •  
  • Related Stuff
    Samples, alternatives and to-be-investigated

Microsoft Access

Open a Microsoft Access database:

    msaccess.exe Database

Open an Access database for exclusive access:

    msaccess.exe Database /excl

Open an Access database for read-only access:

    msaccess.exe Database /ro

Compact and repair an Access database:

    msaccess.exe OriginalDatabase /compact [ CompactedDatabase ]

If no CompactedDatabase is specified, the
OriginalDatabase will be overwritten.

Convert a database from a previous Access version to the current version:

    msaccess.exe OldDatabase /convert NewDatabase

Sources with more details:

  • How to use command-line switches in Microsoft Access (MS Access 1.0..97)
  • How to use command-line switches in Microsoft Access (MS Access 2000..2003)
  • Command-line switches for Access (MS Access 2007)

Not tested

Back to the top of this page . . .

Acronis TrueImage Home

Acronis TrueImage Home saves its backup jobs in script files, located in %ProgramData%AcronisTrueImageHomeScripts.
Each backup job has to be set up manually, once.

Run a backup job:

    TrueImageLauncher.exe /script:"script_name_without_path_and_without_any_extension"

For example, running a DIR command against my Acronis backup scripts folder reveals the following files:

 Volume in drive C is WINDISK
 Volume Serial Number is C0FF-EE01

 Directory of C:ProgramDataAcronisTrueImageHomeScripts

21-03-2016  14:12    <DIR>          .
21-03-2016  14:12    <DIR>          ..
29-01-2016  16:25             3.043 5C8E3F1D-1384-4EA1-A365-38C340611A47.tib.tis
17-04-2015  21:48             1.159 D1E7BA2F-792C-8E9B-1257-785761C66525.tib.tis
               2 File(s)          4.202 bytes
               2 Dir(s)  402.546.192.384 bytes free

Picking the most recent file, the command to run a backup will be:

    "%ProgramFiles%AcronisTrueImageHomeTrueImageLauncher.exe" /script:"5C8E3F1D-1384-4EA1-A365-38C340611A47"

Source with more details:

  • How To Run Acronis True Image Backups from Command Line

Tested with Acronis TrueImage Home 2011 on Microsoft Windows 7 Ultimate SP1 (6.1.7601)

Back to the top of this page . . .

Adobe Reader

Get Adobe Reader

Open a PDF file:

    AcroRd32.exe PdfFile

Open a PDF file in a new instance of Adobe Reader:

    AcroRd32.exe /N PdfFile

Open a PDF file at page 7:

    AcroRd32.exe /A "page=7=OpenActions" PdfFile

Open a PDF file with navigation pane active, zoom out to 50%, and search for and highlight the word «batch»:

    AcroRd32.exe /A "zoom=50&navpanes=1=OpenActions&search=batch" PdfFile

Print a PDF file with dialog:

    AcroRd32.exe /P PdfFile

Print a PDF file silently:

    AcroRd32.exe /N /T PdfFile PrinterName [ PrinterDriver [ PrinterPort ] ]

The last command will open a new Adobe Reader window, print the PDF file and then terminate its window unless that window happens to be the only Adobe Reader window left: at least one Adobe Reader window will be left open.

Sources with more details:

Tested with Adobe Reader 8.1.2 on Microsoft Windows XP Professional SP2 (5.1.2600)

Back to the top of this page . . .

AVG Antivirus

Scan and clean a file (scan inside archives and alternate data streams too):

    avgscanx.exe /scan=file /ext=* /arc /ads /clean

Thoroughly scan and clean the entire computer:

    avgscanx.exe /comp /ext=* /reg /boot /proc /macrow /pup /arc /ads /clean

Run a high priority quick test on the computer, take no action, and report the results including password protected archives:

    avgscanx.exe /comp /qt /priority=high /pwdw /report=d:avgreport.txt

Scan all files in directory d:datadir, move infected files to the virus vault, report the results:

    avgscanx.exe /scan=d:datadir /ext=* /trash /report=d:avgreport.txt

Update virus definitions:

    avgupd.exe
Notes: (1) Use avgscana.exe for Intel 64 bits processors.
  (2) Return codes:
0: everything is o.k.
1: user cancelled/interrupted test
2: any error during the test — cannot open file etc.
3: change identified
4: suspicion detected by heuristic analysis
5: virus found by heuristic analysis
6: specific virus detected
7: active virus in memory detected
8: AVG corrupted
9: double extension
10: archive contains password protected files

Sources with more details:

  • AVGSCANX.EXE /?

Tested with AVG Antivirus version 8.0.145 (engine 8.0.0) on Microsoft Windows XP Professional SP3 (5.1.2600)

Back to the top of this page . . .

CDBurnerXP

Get CDBurnerXP

Open a CDBurnerXP compilation file:

    cdbxp.exe /od CdbxpCompilationFile

List all CD/DVD writers:

    cdbxpcmd.exe --list-drives

Eject the disk in the first CD/DVD writer (device 0):

    cdbxpcmd.exe --eject [ -device:0 ]

Load the disk in the first CD/DVD writer (device 0):

    cdbxpcmd.exe --load [ -device:0 ]

Erase the disk in the first CD/DVD writer (device 0):

    cdbxpcmd.exe --erase [ -device:0 ]

Unfortunately, so far, I haven’t been able to burn a CD with cdbxpcmd.exe yet.

Source with more details:

  • CDBurnerXP: Command line arguments

Tested with CDBurnerXP Pro 4.1.1.660 on Microsoft Windows XP Professional SP2 (5.1.2600)

Back to the top of this page . . .

Digital Photo Professional

Open the d:photos folder in DPP, and display directory tree:

    DPPViewer.exe /path d:photos /tree:on

Open the last used folder in DPP, do not display directory tree:

    DPPViewer.exe /tree:off

Tested with Canon’s Digital Photo Professional 3.7.2.0 on Microsoft Windows XP Professional SP3 (5.1.2600) and Microsoft Windows 7 Ultimate RC (6.1.7100)

Back to the top of this page . . .

Excel

Back to the top of this page . . .

Mozilla Firefox

Get Firefox

Open an url in the browser:

    firefox.exe -url http://www.mozilla.com/

or:

    firefox.exe www.mozilla.com/

Open new private window:

    firefox.exe -private-window http://www.mozilla.com/
Note: Won’t work if another instance of Firefox is running.

Open an url in a new tab in the browser:

    firefox.exe -new-tab http://www.mozilla.com/

Open an url in a new browser window:

    firefox.exe -new-window http://www.mozilla.com/

Search using Firefox’ default search engine:

    firefox.exe -search "batch files"

Make Firefox the default browser:

    firefox.exe -setDefaultBrowser

Sources with more details:

  • Mozilla’s Command Line Options
Note: You may want to experiment with these switches.
On some systems, besides opening a specified URL, I couldn’t get any of these switches working.
This may have be caused by one or more add-ons, or it may not…

Tested with Mozilla Firefox 35.0 on Microsoft Windows 7 SP1 (64-bits) (6.1.7601)

Back to the top of this page . . .

Foxit Reader

Open a PDF file:

    "FoxitReader.exe" PdfFile

Open a PDF file at page 7, zoom factor 75%:

    "FoxitReader.exe" PdfFile /A page=7 zoom=75%

Make Foxit Reader the default PDF reader:

    "FoxitReader.exe" /register

Print a PDF file silently to the default printer:

    "FoxitReader.exe" /p PdfFile

Print a PDF file silently to an alternative printer:

    "FoxitReader.exe" /t PdfFile PrinterName

The next 2 undocumented switches were discovered by Wolfgang Eitel with the aid of SysInternals’ ProcessMonitor (discovered in version 4, still seem to work in version 7):

Force Internet Explorer and Firefox to open PDF files inside the browser window:

    "FoxitReader.exe" -displayinbrowser

Force Internet Explorer and Firefox to open PDF files outside the browser window:

    "FoxitReader.exe" -undisplayinbrowser
Note: Switches (e.g. /A) are case sensitive, commands (e.g. page=7) aren’t.

Source with more details:

  • Page 199 of the Foxit Reader 7 Manual (PDF format)

Tested with Foxit Reader 7.0.6.1126 on Microsoft Windows 7 SP1 (64-bits) (6.1.7601)

Back to the top of this page . . .

Internet Explorer

Get Internet Explorer

Open an URL in Internet Explorer:

    iexplore.exe url

Open Internet Explorer without add-ons (IE 7 and later versions only):

    iexplore.exe -extoff [ url ]

Open Internet Explorer with InPrivate Browsing set to active (IE 8 and later versions only):

    iexplore.exe -private [ url ]

Open Internet Explorer in Windows Explorer mode (IE 7 and earlier versions only):

    iexplore.exe -e Folder

It is not possible to start a Windows Explorer window with alternate credentials.
That is where Internet Explorer’s «Explorer mode» comes to the rescue:
use RUNAS and IE’s -E switch to start an Explorer look-alike window with alternate credentials.
Folder can be in «drive:path» or UNC format.

As of IE 7 this workaround may no longer work, as the -e switch became obsolete (though it still does work on my Windows 7 (64-bits) system).
You may want to try this «direct» approach first:

    explorer.exe /separate[,Folder]

This works in Windows 7 (64-bits), not sure about other Windows versions though.

Open Internet Explorer in kiosk mode:

    iexplore.exe -k [ url ]

Source with more details:

  • Internet Explorer Command Line Options

Tested with Internet Explorer 5..7 on Microsoft Windows 2000 & XP Professional, and with Internet Explorer 8 on Microsoft Windows 7 RC (64-bits)

Back to the top of this page . . .

IrfanView

Open a graphics file:

    i_view32.exe GraphicsFile

Print a graphics file to the default printer:

    i_view32.exe GraphicsFile /print

Print a graphics file to any printer:

    i_view32.exe GraphicsFile /print="PrinterName"

Convert a JPEG file to TIFF:

    i_view32.exe FileName.jpg /convert=FileName.tif

Convert a JPEG file to TIFF, and resize it to 800×600 (but keep the aspect ration):

    i_view32.exe FileName.jpg /resize=(800,600) /aspectratio /resample /convert=FileName.tif

Scan and print a page:

    i_view32.exe /scanhidden /print

Play selected JPG files as a slideshow:

    i_view32.exe /slideshow=drivepathimg*.jpg /closeslideshow

Capture the screen and save it as C:TEST.JPG:

    i_view32.exe /capture=0 /convert=c:test.jpg

Create a contactsheet from all TIFF files in the current directory and save it as CONTACTSHEET.JPG in the same directory:

    i_view32.exe /contactfiles=(*.tif) /convert=contactsheet.jpg

Create a multi-page PDF from all JPEG files in the current directory and save it as MULTIPGAGE.PDF in the same directory:

    i_view32.exe /multipdf=(multipage.pdf,*.jpg) /one

The last example uses the /one switch to allow only one single instance of IrfanView.
If this switch is omitted, multiple instances of IrfanView may be trying to write to the file simultaneously, resulting in «in use» errors.
Wait until IrfanView is no longer running in memory before trying to open the PDF file (this may take several minutes, depending on the amount of data to be processes).

Note 1: All switches must be in lower case.
  2: use i_view64.exe instead of i_view32.exe if a 64-bit IrfanView is installed.

Sources with more details:

  • i_options.txt (in IrfanView’s program directory)
  • IrfanView help file (HH.EXE "mk:@MSITStore:C:Program%20FilesIrfanViewi_view32.chm::/hlp_command_line.htm")

Tested with IrfanView 4.10 on Microsoft Windows XP Professional SP2 (5.1.2600)
Contactsheet and multi-page PDF options tested with IrfanView 4.59 on Microsoft Windows 10 21H2 Professional (10.0.19044.1387)

Back to the top of this page . . .

ISO Writer

Get ISO Writer

Burn ISO file to default CD/DVD writer at maximum speed, eject after writing

    ISOWriter.exe -e ISOFileName.iso

Burn and validate ISO file to CD/DVD writer E: at 16x speed, do not eject after writing

    ISOWriter.exe -r E: -s 16 -v ISOFileName.iso

Sources with more details:

  • ISO Writer — Windows command-line image-burning utility, by Alex Feinman (2016 web archive)
  • Run ISOWriter.exe without parameters to list the command options available in your ISO Writer version.

Back to the top of this page . . .

Macrium Reflect

Get Macrium Reflect

Reflect.exe uses an XML file for its backup job parameters (source disks/partitions, target folder, etcetera).
The XML file must be created by a (manual) setup, and will be saved as «My DocumentsRefectMy Backup.xml» by default.
Once the XML has been created, it can be used to run Reflect from the command line or a script.
It is possible to create multiple XML files for different backup jobs.

Run a full backup:

    reflect.exe -e -full "%UserProfile%DocumentsReflectMy Backup.xml"

Run an differential backup, wait if reflect.exe is still busy:

    reflect.exe -e -diff -w "%UserProfile%DocumentsReflectMy Backup.xml"

Macrium Reflect backups can be verified from the command line with mrverify.exe, which must be downloaded separately.

Verify a backup backup and log the result:

    mrverify.exe "d:targetfolderimagefile.mrimg" -l "%UserProfile%DocumentsReflectMy Backup.log"

Sources with more details:

  • Using Macrium Reflect from the command line
  • Verifying image and backup files from the command line
  • Download mrverify.exe
  • Run reflect.exe and mrverify.exe with parameter -h to list the available command options.

Tested with Macrium Reflect v6.1.1196 Free on Microsoft Windows 7 Ultimate SP1 (6.1.7601)

Back to the top of this page . . .

MagicISO

Get MagicISO

MagicISO.exe is the program’s GUI executable, but in the same directory where MagicISO.exe is installed, MagicISO’s command line tool miso.exe can be found.

List all available CD/DVD writers with their ID number and drive letter:

    miso.exe NULL -cd

Quick erase the disk in the CD/DVD writer with ID number 1:

    miso.exe NULL -e 1

Create and burn a new ISO file to the CD/DVD writer with ID number 2:

    miso.exe ISOFileName.iso -c NewFolder -f NewFolder -a *.* -l3 -l VolumeLabel -be 2
Notes: The -c switch creates a folder NewFolder in the root directory of the ISO image, the -f switch makes this new folder the working directory.
  -a *.* adds all files from the current directory, including subdirectories, to the ISO image’s working directory.
  -be 2 tells the program to quick erase the disk in the CD/DVD writer with ID number 2 if it isn’t blank, and then burn the ISO image to the disk.
  If ISOFileName.iso already existed, the files and folder(s) will be added to the existing ISO image.
  Use -l1 instead of -l3 if you want to restrict file and folder names in the ISO image to their short «8.3 notation».

Delete files from an existing ISO image:

    miso.exe ISOFileName.iso -f Folder -d FileSpec

Convert an existing ISO image to Nero’s NRG format:

    miso.exe NeroFileName.nrg -conv nrg ISOFileName.iso

Sources with more details:

  • Using MagicISO as ISO Creator (May 2021 web archive)
  • Using MagicISO as ISO image burner (May 2021 web archive)
  • Using MagicISO to mount ISO image on Command Line
  • Run miso.exe without parameters to list the command options available in your MagicISO version.

Tested with MagicISO 3.1.113 (link to May 2021 web archive) on Microsoft Windows XP Professional SP2 (5.1.2600)

Back to the top of this page . . .

Nero Burning ROM

Get Nero 9

nero.exe is Nero Burning ROM’s GUI executable, but when Nero is installed, the command line tool NeroCmd.exe will be installed too.
For Nero 8, NeroCmd.exe‘s location can be found in the registry value HKEY_LOCAL_MACHINESOFTWARENeroSharedLib

Open dialogs

Open Nero Burning ROM in the «Create Bootable CD» dialog:

    nero.exe /New:BootDisc /Media:CD

Open Nero Burning ROM in the «Burn Image to CD» dialog:

    nero.exe NeroImageFile /Dialog:BurnImage /Media:CD

Open Nero Burning ROM in the «CD Copy» dialog:

    nero.exe /Dialog:DiscCopy /Media:CD

Open Nero Burning ROM in the «DVD Copy» dialog:

    nero.exe /Dialog:DiscCopy /Media:DVD
Note: A /W switch may be required when using Nero Express.

Unattended

List available CD/DVD writers:

    NeroCmd.exe --listdrives

List drive properties for CD/DVD writer E:

    NeroCmd.exe --driveinfo --drivename E

List disk properties for CD/DVD in drive E:

    NeroCmd.exe --discinfo --drivename E

Eject the disk from drive E:

    NeroCmd.exe --eject --drivename E

Load the disk in drive E:

    NeroCmd.exe --load --drivename E

Quick erase disk in CD/DVD writer E:

    NeroCmd.exe --erase --drivename E --real

Full erase disk in CD/DVD writer E:

    NeroCmd.exe --erase --entire --drivename E --real

Write a Nero image to CD/DVD writer E:

    NeroCmd.exe --write --drivename E --image NeroImageFile --force_erase_disc --real

Quick erase a rewritable disk in E: and then write
«drivepath*.*» to it at 4x speed:

    NeroCmd.exe --write --drivename E --speed 4 --iso VolumeLabel
				--create_iso_fs "drivepath*.*" --force_erase_disc --real
Note: The 2 lines in the command above should be typed as a single line.

Sources with more details:

  • Run NeroCmd.exe without parameters to list the command options available in your Nero version.
  • Info Nero 6 Startbefehle 🇩🇪
    Nero command line switches to start Nero’s GUI in specific dialogs (in German)

Most commands were tested with NeroCmd version 1.9.0.1/Nero API version 6.6.0.19 on Microsoft Windows XP Professional SP2 (5.1.2600), the CD Copy and DVD Copy commands were tested with Nero version 8.0.0.0/Nero API version 8.3.2.1 on Windows XP Professional SP3 (5.1.2600)

Back to the top of this page . . .

Notepad

Open a text file in Notepad:

    notepad.exe TextFileName

Force Notepad to open a text file as ASCII text:

    notepad.exe /A TextFileName

Print a text file with Notepad (default printer):

    notepad.exe /P TextFileName

Tested in Microsoft Windows XP Professional SP2 (5.1.2600)

Back to the top of this page . . .

OpenOffice

Get OpenOffice

Open a file in OpenOffice, don’t show the splash screen:

    soffice.exe -nologo OpenOfficeFile

Open a new text document in OpenOffice:

    soffice.exe -writer
Note: Use
-base for databases,
-calc for spreadsheets,
-draw for drawings,
-impress for presentations,
-math for formulas,
-web for HTML pages, and
-writer for text documents.

Open a document in view (read-only) mode:

    soffice.exe -view OpenOfficeFile

Start a presentation:

    soffice.exe -show OpenOfficeImpressFile

Print an OpenOffice file silently to any printer:

    soffice.exe -pt "PrinterName" OpenOfficeFile

Print multiple OpenOffice text files silently to any printer:

    soffice.exe -pt "PrinterName" *.odt

Sources:

  • SOFFICE.EXE -?
  • Command Line Arguments in OpenOffice
  • OpenOffice FAQ: Is there a way to print a batch of files without opening each of them in OOo?

Tested with OpenOffice.org 2.4.0 on Microsoft Windows XP Professional SP3 (5.1.2600)

Back to the top of this page . . .

PowerPoint

Back to the top of this page . . .

PowerPoint Viewer

Get PowerPoint Viewer 2007

Back to the top of this page . . .

Corel Presentations

Open an existing slideshow or drawing in Presentations:

    Prwin12.exe PresentationsDrawingOrSlideshow

Open a copy of an existing slideshow or drawing as a new file:

    Prwin12.exe /s PresentationsDrawingOrSlideshow

Open Presentations with a new drawing:

    Prwin12.exe /bsd

Open Presentations with a new slideshow:

    Prwin12.exe /bss

Source:

  • Presentations Startup Switches

Tested with Corel WordPerfect Presentations 12.0.0.602 on Microsoft Windows XP Professional SP2 (5.1.2600)

Back to the top of this page . . .

Corel Quattro Pro

Open an existing spreadsheet in Quattro Pro, without showing the «splash screen»:

    qpw.exe Spreadsheet /n

Open a password protected spreadsheet without the password dialog:

    qpw.exe Spreadsheet /spassword

Repair a damaged spreadsheet:

    qpw.exe Spreadsheet /r1
Note: This will remove all objects from Spreadsheet.
If that doesn’t fix the file, use the /r2 switch, which will also remove all formulas.

Source:

  • QuattroPro 12 command line switches

Except for the repair options, tested with Corel Quattro Pro 12.0.0.602 on Microsoft Windows XP Professional SP3 (5.1.2600); /n switch also tested with Corel Quattro Pro X4 on Microsoft Windows XP Professional SP3 (5.1.2600) and Microsoft Windows 7 Ultimate RC (6.1.7100)

Back to the top of this page . . .

Microsoft RAW Image Viewer

Get Microsoft RAW Image Viewer

Open a RAW image in the viewer:

    RAWSupport.exe RawImageFile

Open the print wizard:

    RAWSupport.exe /print RawImageFile

Open a RAW image in the associated editor, if configured:

    RAWSupport.exe /edit RawImageFile
Note: A RAW image editor is not part of Microsoft’s RAW Image Viewer package.

Open the RAW Image Viewer’s configuration dialog:

    RAWSupport.exe /configure

Source:

  • The RAWSupport.exe /? command

Tested with Microsoft RAW Image Viewer 1.1.50.0 on Microsoft Windows XP Professional SP2 (5.1.2600)

Back to the top of this page . . .

Mozilla Thunderbird

Get Thunderbird

Compose an e-mail message, including attachment:

	SET Recipients=to="Recipient",cc="CcRecipient",bcc="BccRecipient"
	SET Message=subject="MessageSubject",body="MessageBody"
	thunderbird.exe -compose %Recipients%,%Message%,attachment="FileToBeAttached"
Notes: The SET commands have been used to split up the command, otherwise the full command line for thunderbird.exe wouldn’t fit in the browser window.
  Like the mailto: technique, you still need to press the «Send» button to actually send the message.

Open the address book:

	thunderbird.exe -addressbook

Sources with more details:

  • Thunderbird command line arguments

Not all command line switches listed in these sources will work in every Thunderbird version.

Tested with Mozilla Thunderbird 2.0.0.14 (20080421) on Microsoft Windows XP Professional SP2 (5.1.2600)

Back to the top of this page . . .

Visio

Back to the top of this page . . .

Microsoft Word

Open a Word document without «splash screen»:

	winword.exe WordDocument /q

Open a Word document in safe mode:

	winword.exe WordDocument /safe

Open a new Word document based on an existing file:

	winword.exe /f WordDocument

Print a Word document:

Open Word and create a macro file with the following content (tested in Word 2007 English, you may need to tweak the code for other versions or languages):

Sub PrintDefault()
'
' PrintDefault Macro
' Print current document to Default Printer
'
	ActiveDocument.PrintOut
	ActiveDocument.Close
	Application.Quit
End Sub

Save the macro as «PrintDefault» in normal.dot.
You only need to do this once.

From now on, you can print a Word document using the following command:

	winword.exe WordDocument /mPrintDefault /q /n

This command opens WordDocument in Word, prints the document, closes it and exits Word.
The /q switch suppresses the «splash screen», the /n switch opens a new instance of Word, so WordDocument won’t show up in the list of documents in any other open instance.
Unfortunately, I haven’t found a way yet to hide Word from view during the process.

Notes: It is possible to create a macro that prints to an alternative printer instead of the default.
Save this macro giving it a logical name, and use that macro in the command to print to that alternative printer.

Using macro’s on the command line opens up other possibilities too, like saving a file in a different format.
Have a go at it!

Sources with more details:

  • List of Word startup switches (MS Word 2000..2010)
  • Command-line switches for Microsoft Office Word 2007

Tested with Microsoft Word 2007 (12.0.6308.5000) on Microsoft Windows XP Professional SP3 (5.1.2600)

Back to the top of this page . . .

Wordpad

Open a text file (any supported format) in Wordpad:

	write.exe TextFileName

Print a text file (any supported format) with Wordpad to the default printer:

	write.exe /p TextFileName

Print a text file (any supported format) with Wordpad to any printer:

	write.exe /pt TextFileName PrinterName [ DriverName [ PortName ] ]
Note: You may use either wordpad.exe or write.exe, both commands will start WordPad.
The only difference is that write.exe is located in the %windir%System32 directory, and hence doesn’t need its fully qualified path specified.

Source:

  • The /p switch was an «educated guess», the /pt switch was found using the command STRINGS wordpad.exe

Tested in Microsoft Windows XP Professional SP2 and SP3 (5.1.2600) and in Microsoft Windows 7 RC (64-bits) (6.1.7100)

Back to the top of this page . . .

WordPerfect

Open a file in WordPerfect, without showing the «splash screen»:

	WPWin12.exe : WpFile

Print a WP file:

Open WordPerfect and create a macro file with the following content (tested in WordPerfect 12 English, you may need to tweak the code for other versions or languages):

Application (WordPerfect; "WordPerfect"; Default!; "EN")
PrintInColor (State: True!)
PrintGraphics (State: False!)
PrintWithDocumentSummary (State: False!)
PrintCopies (NumberOfCopies: 1)
PrintSortOrder (Order: Group!)
PrintDestination (Destination: DriverPort!)
PrintGraphically (State: False!)
PrintTwoSided (Option: LongEdge!)
PrintInReverseOrder (State: False!)
PrintBooklet (State: False!)
PrintAction (Action: FullDocument!)
Print ()
CloseNoSave ()
ExitWordPerfect ()

Save the macro as «PrintAndClose.wcm» in the default location.
You only need to do this once.

From now on, you can print a WordPerfect file using the following command:

	WPWin12.exe : WpFile /M-PrintAndClose.wcm

This command opens WPFile in WordPerfect, prints the document, closes it and exits WordPerfect.
Unfortunately, I haven’t found a way yet to hide WordPerfect from view during the process.

Notes: It is possible to create a macro that prints to an alternative printer instead of the default.
Save this macro giving it a logical name, and use that macro in the command to print to that alternative printer.

Using macro’s on the command line opens up other possibilities too, like saving a file in a different format, or converting («publishing») it to PDF…
Have a go at it!

Sources with more details:

  • WordPerfect Startup Switches

Tested with Corel WordPerfect 12.0.0.602 on Microsoft Windows XP Professional SP2 (5.1.2600)

Back to the top of this page . . .

Microsoft XPS Viewer

Get Microsoft XPS Viewer

Open a file in XPS Viewer:

	    XpsRchVw.exe XpsFile

Load a file in XPS Viewer and open the Print dialog:

	    XpsRchVw.exe XpsFile /p

Convert an XPS file to multipage TIFF:

	    XpsRchVw.exe XpsFile /o:TiffFile.tif

Convert an XPS file to multiple PNG files:

	    XpsRchVw.exe XpsFile /o:PngFile.png

Tested with Microsoft XPS Viewer 1.0.6000.16438 on Microsoft Windows XP Professional SP2 (5.1.2600)

Back to the top of this page . . .

Samples:

  • Capture.bat
    Use IrfanView to append a screen capture to a multi-page TIF file.
  • PrintDoc.bat
    Use Microsoft Word and CMCDDE to print Word documents unattendedly.
  • PrintPPT.bat
    Use PowerPoint or the PowerPoint Viewer to open a print dialog for a powerPoint file.
  • PrnPDF9.bat
    Use Foxit Reader 3 or Adobe Reader 9 to silently print a PDF file.
  • PrintAny.exe
    Print any file that has a registered Print or PrintTo command.

Command line switches I haven’t been able to verify yet:

Alternatives in case a program just won’t print from the command line:

  • Command line DDE
    Control programs that can act as DDE servers.
  • ClassExec
    A command line utility to execute any command, including DDE commands, associated with a file type or extension.
    Use it to open, print, view or edit files, whatever is registered for that file type in HKEY_CLASSES_ROOT.
  • GetPrint.vbs
    Lists non-DDE-based Print and PrintTo commands for all registered file types.
    Read the script’s on-screen help to find out how to filter the print commands for a specific file type or extension.
  • PrintDoc.vbs
    Neither MS Word, nor the Word Viewer accept print commands from the command line.
    So that’s where this script comes to the rescue.
    Based on a script by Arnout van der Vorst, this script prints a specified Word document on the default printer.
  • PrintExcel.exe
    Print Excel spreadsheet from the command line.
  • Print any file using the «Shell.Application» object

page last modified: 2022-11-04

Command-line switches for Microsoft Office products When you launch a Microsoft Office product, the startup process runs in a…

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

Startup command names and locations

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 FilesMicrosoft OfficeOffice12

Windows 64-bit: C:Program Files (x86)Microsoft OfficeOffice12

In Office 2010

Windows 32-bit: C:Program FilesMicrosoft OfficeOffice14

Windows 64-bit: C:Program Files (x86)Microsoft OfficeOffice14

In Office 2013

Windows 32-bit: C:Program FilesMicrosoft OfficeOffice15

Windows 64-bit: C:Program Files (x86)Microsoft OfficeOffice15

In Office 2016

Windows 32-bit: C:Program FilesMicrosoft OfficeOffice16

Windows 64-bit: C:Program Files (x86)Microsoft OfficeOffice16

Use a switch once by adding it to the Run command

  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 filesmicrosoft officeoffice15outlook.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, 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 filesmicrosoft officeoffice15excel.exe" /r "c:My Folderbook1.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 SettingsAll UsersDesktopMyFile.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 Folderbook1.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 Folderbook1.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 Folderbook_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 Folderbook_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 Folderbook1.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 filesmicrosoft officeoffice12POWERPNT.exe» /B

/C

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

Example: «c:program filesmicrosoft officeoffice12POWERPNT.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 filesmicrosoft officeoffice12POWERPNT.exe» /EMBEDDING

/M MACRO

Runs a macro in a specified presentation.

Example: «c:program filesmicrosoft officeoffice12POWERPNT.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 filesmicrosoft officeoffice12POWERPNT.exe» /N «Pathtemplatename.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 filesmicrosoft officeoffice12POWERPNT.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 filesmicrosoft officeoffice12POWERPNT.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 filesmicrosoft officeoffice12POWERPNT.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.

/PWO

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 filesmicrosoft officeoffice12POWERPNT.exe» /PWO «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 filesmicrosoft officeoffice12POWERPNT.exe» /RESTORE

/S

Opens the specified presentation file as a slide show.

Example: «c:program filesmicrosoft officeoffice12POWERPNT.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 filesmicrosoft officeoffice12PPTVIEW.exe» /D

/L

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

Example: «c:program filesmicrosoft officeoffice12PPTVIEW.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 filesmicrosoft officeoffice12PPTVIEW.exe» /N5 «Presentation.pptx»

This example opens Presentation.pptx at slide 5.

/S

Starts the viewer without showing the splash screen.

Example: «c:program filesmicrosoft officeoffice12PPTVIEW.exe» /S

/P

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

Example: «c:program filesmicrosoft officeoffice12PPTVIEW.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 filesmicrosoft officeoffice15outlook.exe» /a «c:my documentslabels.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%microsoftoutlookvbaproject.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

/noextensions

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

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

/resettodobar

Clears and regenerates the To-Do Bar task list for the current profile.

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

/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 filesmicrosoft officeoffice15outlook.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.

MSWord-CLI

A Command Line Interface for Microsoft Word

Table of Contents

  • Summary
  • Installation
    • Installing the latest development code
    • Making the msw command available on your PATH
  • Basic Usage
    • Chaining
    • Plugins
  • Dependencies
  • License

Summary

MSWord-CLI allows you to control Microsoft Word from the command line and/or automate
it from batch or PowerShell scripts. Among other things, you may create, open, print,
export, save, and close Word documents. Note that MSWord-CLI does not actually edit the
content of any documents. That is beyond the scope of this project.

Warning

This is Pre-Alpha software which is in active development. The various subcommands, options,
and arguments are subject to change without notice and may not be sufficiently tested.

All development has been done on Windows 7 with MS Office 2013. Bug reports are welcome on any
system, although the reporter may need to do much of the work on other systems and/or versions.

Installation

Installing the latest development code

If you would like to use the bleeding edge, you can install directly from the the Github Repo.
However, be aware that this code is not guaranteed to be stable or even run. It is recommended
that stable releases be installed instead. Proceed at your own risk.

From the command line execute the following commands as an Administrator:

> git clone https://github.com/waylan/msword-cli.git
> cd msword-cli
> python setup.py install

These instructions assume that Git for Windows, Python and Setuptools are already installed
on your system.

Making the msw command available on your PATH

If you are using Python version 3.4 and you enabled the «Add Python.exe to Path” feature
during installation (off by default), you can skip this section.

Generaly, when running Python, or python scripts from the command line you would need to inlcude the
full path to the script. However, with a little configuration, Windows will find your scripts
without needing to include the full path to the script. You need to tell Windows where the Python
executable (python.exe) and your scripts (msw.exe) can be found by inlcuding those directories
in the PATH environment variable. Therefore, assuming you are using Python version 2.7, add the
following to the PATH environment variable (with no spaces):

C:Python27;C:Python27Scripts

If you are using a differant version of Python, or if you have installed Python in a non-standard
location, you will need to adjust those paths accordingly. See the Python Guide for more information.

If you are using the Python Launcher (py.exe), you will not need to add the path to python.exe to
the PATH environment variable, but you will still need to add the Scripts directory, which is where
msw.exe gets installed.

Basic Usage

To open an existing document:

> msw open mydocument.docx

To print the active (focused) document:

To view a list of all open documents:

> msw docs

Open Documents:

* [1] mydocument.docx
  [2] otherdoc.docx

Notice that the asterisk (‘*‘) indicates that the document at index 1 (mydocument.docx) is the
currently active document. To change the focus to otherdoc.docx (at index 2):

> msw activate 2
> msw docs

Open Documents:

  [1] mydocument.docx
* [2] otherdoc.docx

Unless otherwise specified all subcommands work on the active document.

For a complete list of commands and options, run msw --help from the command line. For help
with a specific subcommand, run msw <subcommand> --help.

Chaining

Subcommands can be chained together. For example, to open a document, print two copies of
pages 2, 3, 4, and 6 of that document, and then close the document, the following single
command is all that is needed:

> msw open somedoc.docx print --count 2 --pages "2-4, 6" close

Note that if any options are specified for a subcommand, those options must be specified after
the relevant subcommand and before the next subcommand in the chain. For instance, in the above
example, somedoc.docx is an argument of the open subcommand, --count 2 --pages "2-4, 6"
are options for the print subcommand and the close subcommand has no options or arguments
defined.

Without command chaining, three separate commands would need to be issued:

> msw open somedoc.docx
> msw print --count 2 --pages "2-4, 6"
> msw close

Either method will accomplish the same end result. However, chaining should run a little faster
as the utility only needs to be loaded once for all commands rather than for each command.

Chaining also allows you to run different variations of the same command when that command’s
options are mutually exclusive. For example, the export subcommand can only accept either
the --pdf or the --xps flag. If you want to export to both formats, you can chain two
export subcommands together :

> msw export --pdf . export --xps .

Note that the dot (‘.‘) in the above example specifies the current working directory as the
export path. All of the common command line paradigms should work out-of-the-box.

Plugins

MSWord-CLI includes support for third-party plugins. A plugin can add additional subcommands
which can be included in a chain. For example, one might desire to have the ability to import
some data to fill a form (perhaps content controls). While it would be unrealistic to try to
include such a script with MSWord-CLI that could meet everyone’s needs, there is no reason
why an individual user could not develop a special purpose script to meet her specific needs.

While the script could be written as a standalone script, it would also be convenient to be
able to include the call within a chain. That way, the document could be opened, the data imported,
and then the document could be printed and closed — all from a single command.

All commands need to be defined as Click commands. Create a new python file named msw_import.py
and define your command:

import click

@click.command('import')
def imprt():
    ''' Import data. '''
    click.echo('Data is being imported...')

Note that while the command is labeled ‘import’ (which will be used from the command line), the
function is named imprt so as not to clash with Python’s import statement. Currently, the
new command only prints a mesage to the console and exits. Before developing the new command’s
functionality, tell MSWord-CLI about the new subcommand and verify that it can be called.
To do that, create a second python file named setup.py and include a setup script:

from setuptools import setup

setup(
    name='MSWImportPlugin',
    version="1",
    description="Import plugin for MSWord_CLI",
    py_modules=['msw_import'],
    entry_points="""
        [msw.plugin]
        import=msw_import:imprt
    """
)

The key is in the entry_points. An entry point was added to the msw.plugin group named ‘import’
which points to the imprt function at its path (msw_import:imprt). Additional commands could
be defined from the same Python module. Simply add an additional line to the entry_points for
each one.

Finally, for MSWord-CLI to find the new plugin, it needs to be installed.

> python setup.py install

The above command will do the trick. However, as the plugin isn’t finished yet, is would be helpful
to use a special development mode which sets up the path to run the plugin from the source file
rather than Python’s site-packages directory. That way, any changes made to the file will
immediately take effect with no need to reinstall the plugin.

> python setup.py develop

Now that the plugin is installed, test the script:

You should find the import subcommand listed among the default subcommands in the help messge.
To ensure that the new subcommand works, try running it:

> msw import
Data is being imported...

As the message was printed to the console, the new import subcommand is being called. Now
the functionally of the import subcommand can be fleshed out, which is left as an exercise
for the reader.

Dependencies

MSWord-CLI is built on Python and requires that Python version 2.7 or greater be installed
on the system. In addition to the python packages listed below, you must also have a working
copy of Microsoft Word installed on your system.

Python Packages:

  • PyWin32
  • Click (version 3)
  • Setuptools

License

MSWord-CLI is licensed under the BSD License as defined in LICENSE.txt.

I need to start MS Word from command line. Now, I pass these commands /q /n /mFilePrintDefault /mFileExit to it. In this case, I need manually press «No» on «save yes/no» dialog at the end (to close Word). What commands need to pass, to skip this (without saving or with saving doc) and automatically close Word?

asked Jan 11, 2012 at 14:57

parzival's user avatar

In Word, create a macro in Normal.dotm using this code:

Sub CloseWithoutSaving()
    ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
    Application.Quit
End Sub

Then pass /q /n /mFilePrintDefault /mCloseWithoutSaving

answered Apr 30, 2014 at 18:52

zach's user avatar

zachzach

3191 silver badge11 bronze badges

2

I assume you are trying to print the document from the command line. You might want to do it the same way MS does it with right-click print. You can see details on this here:

http://www.robvanderwoude.com/ddecommandline.php

answered Jan 11, 2012 at 21:47

Douglas Anderson's user avatar

Douglas AndersonDouglas Anderson

4,63210 gold badges40 silver badges49 bronze badges

0

word logo

Like most apps, you can launch Word from the Command Prompt, but Word also supports several optional switches for controlling the startup process.

Whether you type the command at the prompt, use it to create a shortcut, insert it as part of a batch script, launching Word with additional parameters lets you do things like start Word in Safe Mode for troubleshooting or start with a specific template.

Before we can open Word using the Command Prompt, we need to figure out which directory the winword.exe file is located. You can do this manually, or you can just have the Command Prompt find it for you. To do this, go ahead and open the Command Prompt by opening the start menu and typing “cmd” and selecting the “Command Prompt” application.

Open Command Prompt in Start Menu

When you open the Command Prompt, you’ll be in the top tier directory—your user account folder. We need to dig deeper by going into the Program Files directory. Do so by entering the following command and then pressing Enter:

cd”program files (x86)”

Program Files in Command Prompt

You’ll now be in the Program Files directory. The next step is to locate the directory where the winword.exe file is located. Do so by typing the following command and pressing “Enter.”

dir winword.exe /s

Once you enter this command, the Command Prompt will locate the directory for you.

Winword directory

Now that you know the directory where the winword.exe file is located, you can use the cd command to open the file path. In this example, you would need to enter the following command:

cd Microsoft OfficerootOffice16

Now you should be in the directory where winword.exe is located.

Open Winword file

Now, if you want to open Microsoft Word the same way as if you were opening it via its icon, all you must do is type winword and then press “Enter,” and Word will open its usual way.

Open Normal Word

However, the whole point of using the command is that you can use the different switches and parameters it offers.

Common Word Command Line Switches and Parameters

Borrowed from the official Microsoft Office support site, here is a list of some possible ways to open Word, along with its respective command.

Switch and Parameter Description
/safe Starts Word in Safe Mode. This launches Word without any additional add-ins, templates, and other customizations. It’s helpful when troubleshooting problems in Word.

You can also launch Word in Safe Mode by holding down the Ctrl key while launching Word from the Start menu, creating a shortcut with this parameter makes it that much easier.

/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: Assume we wanted to open a document stored on the C drive called example.docx, we’d type the following command:

/tc:example.docx

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

/t filename Starts Word and opens an existing file.

Example: To start Word and open the existing file example.docx, stored on the C drive, enter the following:

/t c:example.docx

To open multiple files, example.docx and example2.docx, located in the C drive at once, enter the following:

/t c:example.docx c:example2.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 example.docx, stored on the desktop, enter the following:

/f “c:Documents and SettingsAll UsersDesktopexample.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 a file example.docx, stored in a document library at the URL http://MySite/Documents, enter the following:

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

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

/pxslt Starts Word and opens an existing XML document based on the specified XSLT.

Example: To start and apply the XSLT MyTransform, stored on the C drive, enter the following:

/pc:MyTransform.xsl c:Data.sml

/a Starts Word and prevents add-ins and global templates (including the Normal template) from being loaded automatically. The /a switch also locks the settings files.
/ladd-in Starts Word and then loads a specific Word add-in.

Example: To start Word and load the add-in Sales.dll, stored on the C drive, enter the following:

/ic:Sales.dll

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

/m Starts Word without running any AutoExec macros.
/mmacroname Starts Word and the 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, enter the following:

/mSalelead

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

/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 other instances.
/r Re-register Word in the Windows registry. This switch starts Word, runs Office Setup, updates the Windows registry, and the closes.
/x Starts Word from the operating system shell so that Word responds to only one 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.

That’s all there is to it! Now you should be able to open Word in any specific way you choose by simply following these commands.

RELATED: How to Run Command Prompt Commands from a Windows Shortcut

READ NEXT

  • › How to Turn Off Track Changes in Word
  • › How to Put Borders Around Images in Microsoft Word
  • › How to Make Columns in Microsoft Word
  • › How (and Why) to Start Microsoft Excel from the Command Prompt
  • › How to Link or Embed a PowerPoint Slide in a Word Document
  • › How to Troubleshoot Word Startup Problems
  • › How to Turn Off Dark Mode in Microsoft Word
  • › Microsoft Outlook Is Adding a Splash of Personalization

How-To Geek is where you turn when you want experts to explain technology. Since we launched in 2006, our articles have been read billions of times. Want to know more?

on February 8, 2012

We can launch Microsoft Word application from run window by running the command winword.

Run command for Microsoft word

Open MS word from Run window

Note that this command does not work from command line as winword.exe location is not added to the PATH environment variable. However, we can use the below command to open Word application from command prompt.

start winword

The above commands work with all editions of MS Word and Office.

To open an existing word document from command prompt

start winword

For example, to open the file C:UsersmyloginResume.docx, the command would be

start winword C:UsersmyloginResume.docx

Понравилась статья? Поделить с друзьями:
  • Word coming out of mouth
  • Word comes over you
  • Word comes by hearing
  • Word come in family
  • Word come from the top