Windows – Where is path in sublime text 3 for Windows

sublimetext3windows

It seems the PATH in sublime doesn't match the system variable.

My System Variable PATH is

C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Users\lwj.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\nodejs\;C:\Program Files (x86)\Skype\Phone\;C:\Ruby23-x64\bin;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Program Files\nodejs;C:\Users\lwj\AppData\Roaming\npm;C:\Program Files\MongoDB\Server\3.2\bin;C:\Program Files\Git\bin;C:\wamp_2.5\bin\mysql\mysql5.6.17\bin;C:\Program Files\Java\jdk1.8.0_92\bin

However, in Sublime it is:

C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Users\lwj.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\nodejs\;C:\Ruby23-x64\bin;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Program Files\nodejs;C:\Users\lwj\AppData\Roaming\npm;C:\Program Files\MongoDB\Server\3.2\bin;C:\Program Files\Git\bin

Where I can modify the PATH for sublime text 3?

Best Answer

You modify the PATH in each build system by altering the "path" key. So, on Windows, you could have something like the following:

{
    "shell_cmd": "python -u \"$file\"",
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python",
    "path": "C:/Python35;$PATH"
}

You'll notice that I used forward slashes / for the path delimiter (you can also use double backslashes \\ if you wish, just don't use single backslashes, as bad thingsā„¢ could happen), a semi-colon ; to separate the path components, and the Unix-style $PATH environment variable to represent the rest of your path, if needed. In this case it isn't, but in some cases it may be. If you ever end up working on OS X or Linux systems, you'll of course always use forward slashes for path delimiters as well as colons : to separate paths.

In the above example I altered the "path" so the system could find the python executable. Alternatively, I could simply do:

{
    "shell_cmd": "C:/Python35/python -u \"$file\"",
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python"
}

and put the path to python.exe right in the "shell_cmd" field. Please read the complete build system docs (linked above) to find out about all the fun things you can do with them, and all the options and variations that are available.