How to Start Microsoft Word from the Command Prompt

448436 How to Start Microsoft Word from the Command Prompt

The command prompt allows you to access some powerful features and functions in Microsoft Word that aren’t available just by double-clicking the desktop icon. By launching Word from the command line, you can automate tasks, run Word without the UI, execute macros, and more. This tutorial will teach you everything you need to know to harness the command prompt for opening Word documents and taking advantage of built-in command line switches.

An Introduction to the Command Prompt

The command prompt, also known as the Windows console or terminal, is a text-based interface in Windows operating systems that allows you to access the command line. From the command line, you can launch programs and scripts, access system functions, create/manage files and folders, and automate repetitive tasks by writing batch files.

Here are some of the most common reasons why you might want to launch Microsoft Word from the command prompt rather than through the Start menu or desktop icon:

  • Automation – Script Word tasks like opening documents, formatting, converting files, etc.
  • Speed – Open Word faster without waiting for the UI to load
  • Portability – Call Word from any directory without needing to navigate there first
  • Control – Utilize command line switches to customize how Word starts up

In order to use the command prompt with Word, you’ll need:

  • Command prompt access enabled on your Windows machine
  • To know the file path where Word is installed on your system

Let’s look at how to find that file path next.

Finding the File Path for WINWORD.EXE

The executable file that launches Microsoft Word is called WINWORD.EXE. Before you can open Word from the command line, you’ll need to know the full file path pointing to the WINWORD.EXE file on your computer.

Here are the steps to find the file path:

  1. Open File Explorer on your Windows machine
  2. Navigate to C:\Program Files\Microsoft Office\root\Office16 (or wherever Office is installed)
  3. Verify that you see the WINWORD.EXE file in this folder
  4. Copy the full path from the address bar in File Explorer
  • Example: C:\Program Files\Microsoft Office\root\Office16\WINWORD.EXE

You will use this file path in the next steps when typing commands at the prompt to start Word.

Launching Microsoft Word from the Command Prompt

Once you have opened up a command prompt window and know the file location of WINWORD.EXE, you can now launch Word with just a few keystrokes.

Follow these steps:

  1. Type cmd in the Windows search bar and press Enter. This will open the command prompt.
  2. Type the full file path to WINWORD.EXE in double quotes:
   "C:\Program Files\Microsoft Office\root\Office16\WINWORD.EXE"
  1. Press Enter to launch Microsoft Word!

And that’s it! The Word user interface will now open up.

Note: Be sure to use straight double quotes around the file path, not curved smart quotes, or you may get an error.

Opening Word Documents from the Command Prompt

Simply launching Word from the command prompt is handy, but the real power comes from being able to automate opening documents this way too.

Using the /f switch, you can specify a Word document to open automatically when the program starts up.

For example:

"C:\Program Files\Microsoft Office\root\Office16\WINWORD.EXE" /f "C:\Users\Name\Documents\Report.docx"

This will open the Report.docx file located in my Documents folder when Word starts.

Some things to keep in mind when using the /f switch:

  • Enclose the file path in straight double quotes
  • Use the file’s full path, not just the file name
  • Works for .doc, .docx, .rtf, .txt and other file types Word supports

This makes it easy to access documents from any directory without needing to first open Word and navigate there manually.

Disabling Add-ins when Launching Word

Sometimes Word add-ins can cause strange behaviors and even make the program crash if there are compatibility issues after Office or Windows updates.

Luckily there is a command line switch that lets you easily disable add-ins when opening Word from the prompt:

"C:\Program Files\Microsoft Office\root\Office16\WINWORD.EXE" /safe

The /safe parameter prevents any third party startup add-ins from loading when Word launches. This allows you to open the program cleanly without interference from other components.

If Word then opens normally without crashing, you know an add-in is causing the problem. You can then troubleshoot and selectively re-enable them one by one if needed.

Running Word Macros from the Command Prompt

Here’s an exciting trick – you can use the command prompt to directly run your Word macros without even needing to open a document in the UI first!

This makes it easy to execute your macros on demand from any directory, ideal for automating workflows.

To run a macro, use the /m switch followed by the macro name.

For example, to execute a macro called “MyMacro”:

"C:\Program Files\Microsoft Office\root\Office16\WINWORD.EXE" /mMyMacro

Word will start, run the MyMacro macro, then close automatically.

Some tips for running macros from the command line:

  • Don’t include spaces around the macro name after /m
  • Works well with personal and global template macros
  • Use error handling in your macro code to catch crashes

This is just one example of how powerful automation can be leveraged from the command line!

Additional Useful Command Line Switches

Here are some other helpful switches you can append when launching Word from the prompt:

  • /q – Quiet mode, doesn’t display splash screen/tips on startup
  • /n – Opens second Word instance if one is already running
  • /p – Starts Word with print dialog open, ready to print document
  • /h – Minimizes Ribbon UI, leaving just file menu and toolbar

For the full list, type WINWORD /? at the command prompt to see descriptions of all available options.

Automating Word with Batch Files and Scripts

One final use case to highlight is automating Word via scripts and batch files. The command prompt integrates easily with batch files (.bat), PowerShell (.ps1), VBScript (.vbs) and more.

By writing scripts, you can have the command line:

  • Loop through multiple documents
  • Open groups of files
  • Run sequences of macros
  • Rename/convert files
  • Output docs as PDFs
  • Email results
  • etc.

The possibilities are endless! Anything you can do from within Word can also be automated through clever use of command line scripts calling WINWORD.EXE.

This just scratches the surface of the automation functionality exposed from the command line interface.

Conclusion

In closing, while the graphical Windows interface provides an easy way to interact with Microsoft Word, the old command prompt continues to enable features and system access that GUI apps can’t match.

By launching Word from the command line rather than through the Start menu or desktop icon, you unlock advanced automation, scripting, and customization capabilities.

The command line is still very relevant in 2024 – take advantage of it to get the most out of Word on your Windows machine!

Let me know if you have any other questions.

About The Author