I can open Notepad just by typing notepad or notepad.exe in command prompt. But for other installed applications, I have to browse to the location first and then run the .exe file. Why is that? Can somebody explain this?
Starting an Application via Command Prompt
cmd.execommand line
Best Answer
I have to browse to the location first and then run the .exe file.
This is because your other applications are not in the search path for exectable files.
Windows has a built in environment variable (
PATH
) which contains a list of directories. The list is searched when trying to find a command to execute:The current path can be displayed by typing
PATH
without any parameters on the command line.For example here is my path:
How do I add a program to the path?
From a command line:
You can use the
set
command to do thisNote:
myapplication
is the directory containing your applicationset
will only set thePATH
for the current commmand prompt.setx
to permanently change thePATH
From the Windows GUI:
Source How to set the path and environment variables in Windows
Further Reading