How to invoke a program in Windows from command prompt?

You need to add the path of the folder containing notepad2.exe not the full path to the actual exe. So use:

C:\Program Files\Notepad2\

NOTE: Changes you make to your PATH (or any other Environment Variable) do not take effect in programs that are already running. The easiest way to make sure that your changes take effect for all programs is to log out and then back in again (or restart the computer, if you also want Windows System Services to see the change). However, if you just need to use the changes in the Command Prompt, it is enough to close the cmd window and reopen it.


Depending on what you are doing, it is also possible to use the "App Paths" registry key.

This is how you are able to launch a number of applications, e.g. Chrome, Firefox, notepad++.exe, etc.., without them being in your "PATH".

Plus, it's best to keep the PATH variables as clean as possible, it will save a number of unnecessary files searches when the Search path is used. The order of the values in the path should also be considered for this reason.