Where can I permanently modify $Path?

You can add the following line:

AppendTo[$Path, FileNameJoin[{$UserBaseDirectory, "ExtraPackges"}]]

to the file:

FileNameJoin[{$UserBaseDirectory, "Kernel", "init.m"}]

init.m is described here, under "more information".


To do this automatically you can run:

With[
 {newPath = FileNameJoin[{$UserBaseDirectory, "ExtraPackges"}]},
 PutAppend[
  Unevaluated @ AppendTo[$Path, newPath],
  FileNameJoin[{$UserBaseDirectory, "Kernel", "init.m"}]
 ]
]

You could modify the global options in the options editor (Win.OS**Ctr + Shif + O**).

look up the EvaluatorStartup and put code

AppendTo[$Path, FileNameJoin[{$UserBaseDirectory, "ExtraPackges"}]]

into the value box and restart the frond end, check the $Path again. Note that ; is necessary to separate different codes.

enter image description here

Update: for multi-paths, use this code

If[!MemberQ[$Path, #] && DirectoryQ@#, 
   AppendTo[$Path, #]] & /@ {FileNameJoin[{$UserBaseDirectory, "ExtraPackges"}],"C:\\temp\\"}

if user defined package MyPackage` located in C:\temp\, then you can find the init.m by

FindFile["MyPackage`"]

and load it with this code

Get[FindFile["MyPackage`"](*,CharacterEncoding -> "UTF8"*)(*optional*)]