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.
Using the Command Prompt to Start Word
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.
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)”
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.
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 Office\root\Office16
Now you should be in the directory where winword.exe is located.
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.
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:
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:
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 Settings\All Users\Desktop\example.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:
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:
|/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:
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:
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.