How to run a program from CMD

Run program from CMD

This time we are going to explain in a simple way how to run a program from CMD, also known as the command line or Terminal. Learning to use the Windows command interpreter can be intimidating for many users. However, mastering this tool allows you to gain more control over your operating system and perform a wide variety of tasks with greater efficiency.

Among the things you can do from the command line is the execution of programs that you have installed on your computer. By simply typing the path, you can open any program, folder or file hosted on your storage drive. Since this topic is quite broad, we will mainly talk about the basics you need to know to run a program from CMD.

Running programs from CMD: what is the Windows command interpreter?

command key

Let's start by reviewing the concept of CMD, what this tool is for and what are the advantages of using it. Later we will talk about what is the procedure to run a program from CMD, adding some simple examples to make everything clearer. At the end, we will see how to edit the system environment variables to make it much easier and faster to open any program from the Windows command prompt.

In essence CMD is a tool that allows us to execute text commands to perform various actions and tasks in the Windows operating system. Its name comes from the cmd.exe executable file that opens the command window, also called Command Prompt. Keep in mind that CMD is not the same as MS-DOS, although it is based on its capabilities and looks similar (but let's not get sidetracked).

What is the CMD used for? This tool has multiple functions such as access and modify Windows settings, create and manage files and folders, troubleshoot problems, and perform advanced administrative actions. It also serves to automate processes through scripts or batch files and, what we are interested in, running programs. It is clear that, to use the CMD, you need to know the available commands and the correct syntax to enter them.

How to run programs and .exe files from CMD

CMD command prompt

Now let's talk about the topic that concerns us: how to run a program from CMD or command line in Windows environments. Actually, the steps are very simple, but you have to make sure that you spell the commands correctly and use the correct symbols.. The best way to master this Windows tool is to practice without fear of making a mistake.

Open the Command Prompt window

The first thing you have to do is open the Command Prompt, which is nothing more than that window with a black background and white letters in a basic interface. To open the Command Prompt window you have several options, the most common and easiest being the following:

  • Using the 'Run' tool, which you can open by pressing the 'Windows + R' keys at the same time. Now type in the text field 'cmd.exe' and press the 'Enter' key.
  • Alternatively type cmd in the Windows Toolbar, and then click on the 'Run as administrator' option.
  • You can also create a Command Prompt shortcut on the Desktop, to always have it available. Right click on the Desktop and choose the options 'New' > 'Shortcut'. Now type cmd in the text field and click 'Next' > 'Finish'.

Type the name of the program you want to run

Run programs from CMD

Once you've opened the Command Prompt window, it's time to type the name of the program or tool you want to run. In this sense, keep in mind that To run certain .exe files, you need to type the full path. Instead, to open other programs, such as the calculator, the blog of notes or Paint, just type the name.

For example, if you want open the calculator from CMD, you must type calc and press Enter. The path would look like this: C:\Users\HP>calc. Other programs that you can run from CMD together with its commands are the following:

  • Symbol of the system: cmd (opens a new window)
  • File Browser: explorer (you open the file explorer window)
  • Memo pad:notepad
  • Paint:mspaint
  • Windows Media Player:start wmplayer
  • Task Manager: taskmgr
  • Control panel:control-panel
  • Characters map: charmap
  • Land: magnify
  • View on-screen keyboard:osk
  • Open Microsoft Word:start winword

Run .exe files in CMD

person in front of a computer

As we already clarified, to run some programs from CMD it is necessary to write the full path where they are located. Finding this path can be a bit tedious, especially if it's the first time you're trying to open a program on your computer this way. Nevertheless, is there a very easy way to find the full path to a particular program, then copy and paste it into the shell.

The easiest way to find the path to an .exe file is by right clicking on the program shortcut and selecting 'Open file location'. Once the location is open, we click on the upper text bar and copy the path with Ctrl+C. Immediately afterwards, we go to the window to the command interpreter, paste the path with Ctrl + V and press Enter.

Now, is there a way to open a program from CMD by typing its name, without having to specify the full path? There is, and for that you have to modify system environment variables. Let's explain this simply.

Edit system environment variables to run programs from CMD

edit system variables run cmd programs

System environment variables are those that affect all users and programs running on the computer. These variables store information such as the path to the executable files, the current working directory or the name of the operating system. To edit the system environment variables and be able to open programs from CMD, the following steps must be followed:

  1. Open Control Panel and select 'System and Security'.
  2. Click 'System' and then 'Advanced system settings'.
  3. In the 'Advanced Options' tab, click on 'Environment Variables'.
  4. In the 'System Variables' section, click 'New' to create a new variable.
  5. Now write the name and value of the variable. The value must include the full path to the program you want to open from CMD, separated by semicolons (;) from any other paths in the variable.
  6. Click OK to save your changes and close any open windows.

Once this is done, you will be able to run a third-party program from CMD without having to type its full path. It will be enough to write the name in the command interpreter and the program will open immediately. This is especially useful if you use certain programs on a regular basis and want to quickly open them from CMD.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Actualidad Blog
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.