20

I've added Notepad2 path to Path

enter image description here

And when I do notepad2 somefile.js - it says it's not recognized as an internal or external command.

I tried notepad2.exe - still doesn't work. What else I should do to be able to do what I can do with notepad? i.e. notepad somefile.txt - boom, opens it.

  • 29
    Is that colour scheme deliberate? :) – Lightness Races in Orbit Feb 13 '17 at 19:07
  • 7
    @LightnessRacesinOrbit Yes, it is. Custom made. Win 7 Pro but it's an older PC so I switched to Windows Classic theme to make it a bit faster. No sunlight. – Marina Dunst Feb 13 '17 at 19:26
  • 1
    An app I can't live without any more, when editing PATH and other environment variables: rapidee.com – Ajasja Feb 14 '17 at 8:58
56

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.

  • 15
    Changes to your environment variables typically require a reload, so log out/log in should be sufficient, but a restart would do the trick as well. – heavyd Feb 13 '17 at 18:45
  • 3
    Yay! It works! Victory for me, victory for everyone! Thanks! – Marina Dunst Feb 13 '17 at 18:49
  • 1
    @MarinaDunst You can also restart explorer by opening the task monitor, killing all explorer.exe instances and then starting explorer.exe in File/Run new task. This will reload the environment variables for explorer, which will pass it along to all the new programs you start from it. – isanae Feb 13 '17 at 23:05
  • 8
    When running from command line, you don't have to restart, log out, or kill explorer, you just need to kill all instances of CMD. And, actually, I'm think that any new instance will work, so you don't have to kill things that aren't related. – David Feb 14 '17 at 6:36
  • 1
    @David Environmental variables are inherited from the launching process by default - so unless that's disabled (as in e.g. the run dialog IIRC), you need to restart the launcher as well. In most cases, that's explorer (start menu, desktop, "My Computer", anything that uses the shell, really). That's why relogging or restarting helps - you reload the shell, which reads the stored environmental variables. You don't have to kill all instances of CMD - only the ones where you want to use that variable. – Luaan Feb 14 '17 at 8:42
6

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.

  • 2
    To add to EMK's answer, if a program has been added to App Paths, it can be started with the start command. – Random832 Feb 14 '17 at 4:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.