Command Prompt basics: Starting and stopping processes

Reading time icon 2 min. read


Readers help support Windows Report. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help Windows Report sustain the editorial team Read more

Command Prompt basics: Starting and stopping processes

Using the Command Prompt can be a quick way to launch programs, especially Windows management utilities which might be fiddly to find through search.

We’ll look at a few basic procedures for working with programs and processes.

Launching programs

To launch a program from Command Prompt, simply type its name:

notepad

This will launch a new Notepad instance. The example works because Windows already knows where Notepad is. Command Prompt automatically searches the working directory (the path shown at the start of the prompt line) and Windows system directories when you run a program in this way.

Starting a program in Command Prompt

When the executable resides elsewhere, you’ll need to specify its entire path – C:WindowsSystem32notepad in this example.

An alternative way to launch programs is via the start command:

start notepad

This has the same effect as the above example. However, the launch mechanism is slightly different – Command Prompt will hand off to Windows itself, which will take care of finding the right program. More locations will be searched, including the entire contents of the PATH environment variable and “app path” shortcuts defined in the registry (a way of shortening long executable paths using aliases).

Chaining commands

You can chain commands by combining them with an & character:

dir & notepad

This will display the contents of your working directory in the terminal and then open Notepad.

A variation can be achieved using && instead:

dir && notepad

In this form, the second command will only run if the first one executes successfully. Were there to be an error listing your directory contents, Notepad would not open. (Note: You can achieve the inverse using ||, so dir || notepad would run Notepad only if the dir command failed.)

Ending processes

You can also use the Command Prompt to end processes. This is ideal when you need to kill a program but don’t have a mouse to hand, or Task Manager itself is being unresponsive.

taskkill /F /IM "notepad.exe" /T

The above command will immediately kill any running instance of Notepad. Subsitute notepad.exe for the name of the program you’d like to kill. You can get this information by running tasklist to view a list of all the currently running processes.