How To Run a File in Command line in 2 Easy Steps
When you open a program by double-clicking its icon, you activate the program’s .exe file, which results in the program’s launch. For example, when you open PowerPoint, you usually see the PowerPoint splash screen before the program opens the default screen, where you can open a new file or select the file you were working with.
But double-clicking the icon is not the only way to open the program. Back in the old days, before Windows, Microsoft produced the DOS operating system, which didn’t even have a clickable icon. To open a program, you had to type a command in the command line. This takes a bit more time but has the advantage that you can tell your computer exactly how you want the program to open and what you want it to do once it opens.
Command line inputs have always been a part of Microsoft operating systems, including Windows 10. You can open PowerPoint with a command line command and specify what to do using subcommands or switches.
Familiarity with commands
In older versions of Windows, if you wanted to type a command, you must first open the Command Prompt tool or CMD. In Windows 10, you can still open CMD and use it to type commands. To do this, type “cmd” in the Start menu and press Enter.
As you probably guessed, if you can run CMD.exe from the Start menu, you can also run PowerPoint by typing “PowerPoint” into the Start menu. More precisely, you can also type the name of the Powerpoint .exe file, either in the CMD window or in the Windows Start menu: powerpnt.exe (note “pnt” not “point”) Type “powerpnt” without typing .exe also opens the program.
Note: Commands are not case-sensitive. You can use lowercase, uppercase, or a combination of them.
Name and location of Office files
Before you can run a program from the command line, you need to know its name and if you’re using the CMD utility, its location. Office 2016 files, if you installed Office in its default location, are
located in the following folders:
Windows 32-bit: C:\Program Files (x86)\Microsoft Office\root\Office16\
Windows 64-bit: C:\Program Files\Microsoft Office\root\Office16\
If you have an old version of Office, it is probably in the Office15 or Office14 folders. Future versions of Office may be in folders with higher numbers.
.exe files of each Office program:
- PowerPoint: powerpnt.exe
- PowerPoint indicator: pptview.exe
- Word: winword.exe
- Excel: excel.exe
- Outlook: outlook.exe
- Access: msaccess.exe
Typing any of these file names in the Windows Start menu will run the desired program.
Opening PowerPoint from the CMD tool is a bit more complicated because CMD, when opened, goes to the private folder: your user folder. PowerPoint is not in that folder, so you must first open the correct folder. In CMD, folders are called directories.
How to enter PowerPoint folder in CMD?
1- Open the File Explorer window and type “powerpnt.exe” in the search menu at the top of that window. After a few moments, File Explorer will show you the file with its path written below, like this:
C:\Program Files (x86)\Microsoft Office\root\Office16\
2- Type “\cd” in the command prompt and press the enter button. This change folder command places you in your computer’s C drive instead of your user folder.
3- Enter the word “cd” with a space and then the first folder, such as “cd, program files,” and press enter to move to that folder.
4- Continue searching through the folders until you reach the folder where PowerPoint is located, such as “cd program file(x86)” and then “cd microsoft office” and so on.
5- Type “dir” to see the contents of the folder (or directory) you are in, and press enter to see if powerpnt.exe is in it. Once you are in the correct folder, typing “powerpnt.exe” will open PowerPoint.
Getting to know the start command switch
The command line switch or subcommand adds an instruction that tells the computer exactly how you want the program to open. A switch comes after the main command and space and begins with a slash. For example, to open PowerPoint and then immediately open a new blank field, type:
powerpnt.exe /b
You can also use a switch to open a specific file. But you need to specify exactly where this file is located so that PowerPoint can find it. The PowerPoint files you create usually have the extension pptx. are. So, if your files are in your Documents folder, the location of the file named “presentation” will be:
C:\Users\YourName\Documents\presentation.pptx
Note: Anything you type after the switch is called a parameter. Unlike commands, parameters are sometimes case-sensitive.
Using PowerPoint commands and switches
In the following, you can see some examples of frequently used commands with PowerPoint switches.
/B: Opens PowerPoint with a blank presentation page.
Example:
“powerpnt.exe /b
/C: Runs PowerPoint with a specified file and also runs Microsoft Windows NetMeeting conference mode.
Example:
powerpnt.exe /CC:\Users\YourName\Documents\netmeetingfile.pptx
/EMBEDDING: Opens PowerPoint without displaying the Office PowerPoint program page. This mode is usually done by web developers to test plugins.
Example:
powerpnt.exe /EMBEDDING
/M: This switch command executes a macro in a specific presentation file.
Example:
powerpnt.exe /MC:\Users\YourName\Documents\test.pptx MyMacro
In this example, the “MyMacro” macro is used in the test.pptx file.
/N: Opens PowerPoint and creates a new presentation based on the template you specify.
Example:
powerpnt.exe /N Path\customtemplate.potx
In this example, “path” represents the location of the template.
/O: Runs PowerPoint and selects and opens a list of files instead of just one file.
Example:
powerpnt.exe” /O File presentation1.pptx, File presentation2.pptx
/P:: This command prints the presentation switch to your default printer. And causes the print dialog box to open.
Example:
powerpnt.exe /p MyFile.pptx
/PT: This switch prints the presentation to the printer you specify and opens a dialog box.
Example:
powerpnt.exe” /PT “PrinterName” “” “” “MyFile.pptx”
Note that you must enter empty quotes.
/RESTORE: If PowerPoint crashes, you can use this switch to restore PowerPoint to the state it was in before closing. PowerPoint tries to restore the presentation you were working on.
Example:
powerpnt.exe /RESTORE
/S: This switch opens the file you specified as a slideshow.
Example:
powerpnt.exe /S C:\Users\YourName\Documents\show.pptx
Creating a shortcut in the command line
If you plan to use a switch in the command line more than once, you can create a shortcut for it and place it on your desktop.
1- Right click on the Windows desktop. Select “New” and then click “Shortcut” to open the shortcut creation program.
2- Click on “browse” and find the POWERPNT.EXE file or type its location with the file name in quotes. Note the case: “C:\Program Files (x86)\Microsoft Office\root\Office16\POWERPNT.EXE”
3- After typing a space, type the switch you want to use along with any parameters you need. For example, to open a new empty presentation, you would use this statement:
“C:\Program Files (x86)\Microsoft Office\root\Office16\POWERPNT.EXE” /b
4- Click Next and then enter a name for the shortcut.
5- To open PowerPoint with your switch, double-click the shortcut.