Running and stopping programs in Command Prompt
- Use start notepad.exe to start a program.
- Use taskkill /F /IM “notepad.exe” /T to kill a program.
Applies to All Windows 10 Versions
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.
To launch a program from Command Prompt, simply type its name:
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.
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:
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).
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.)
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.