[TUT] Basics: Environment Variables
#1
~~~~ Hey all, I trust you're well ~~~~

Yep, this will be another one of those refer-bla threads. 
I'm just going to be talking a bit about Environment Variables. 
This will be a very short and concise tutorial, 
solely for the purpose of providing context 
and support in other threads...

I personally develop on a Windows machine, so unfortunately that's all I'll be using.






Environment Variables


"Environment variables are sort of like global variables in programming - they can be called from anywhere." - @Albus


Stored directories that allow you to access files and executables from your terminal without having to
navigate to the directory in which they exist. For instance,
say you installed a CLI utility of some sort, call it pearl ...
if you now opened your terminal/cmd and typed pearl ... 
if the system knows it's location of existence, 
then it will execute it and take it from there.

But if it doesn't, you will get an error that says something like this:

'pearl' is not recognized as an internal or external command, operable program or batch file





Solution



All you need to do is add the directory of pearl.exe as an environment variable.



1. Open Environment Variables Dialog

[Image: 89af071fce3048edb6391417da22d0be.png]





2. Click on Environment Variables and click Edit

[Image: 2d008e2bf9a04cf7b273fbf6e065e6a3.png]





3. Paste the directory where pearl.exe is located, and OK out of everything


[Image: 1efcacfc55d542caa5a0d8c960053ad3.png]



Done! The console should no longer be saying that it doesn't recognize pearl





Pardon me for any inaccuracies.  Feel free to share your relevant thoughts, concerns and opinions in the comment section below,
 I'll try to answer you if and when I feel it's appropriate and necessary. 
If I don't, perhaps another member will.

 Thank you for reading my thread, I hope you benefited and or enjoyed. 

Have a nice day. Hat Tip


#2
I doubt that I will be needing this soon, but this is always a useful reference if this ever happens.
Thanks for the tutorial!
Reply
#3
If people are intrested in how to add any other paths from any other thing here some more since he covered pearl. Also I really nice tutorial.

Java
Code:
C:\Program Files\Java\jdk{VERSION}\bin
Composer
Code:
C:\Users\{USERNAME}\AppData\Roaming\Composer\vendor\bin
Reply
#4
(07-24-2016, 11:22 PM)Coddr Wrote: Java
Code:
C:\Program Files\Java\jdk{VERSION}\bin
Composer
Code:
C:\Users\{USERNAME}\AppData\Roaming\Composer\vendor\bin
Note to readers: The above assumes that you're running windows, and that you've installed Java/Composer in that specific directory. 


(07-24-2016, 11:22 PM)Coddr Wrote: Also I really nice tutorial.

Thank you. Hat Tip
Reply
#5
(07-25-2016, 02:03 AM)Baredee Wrote:
(07-24-2016, 11:22 PM)Coddr Wrote: Java
Code:
C:\Program Files\Java\jdk{VERSION}\bin
Composer
Code:
C:\Users\{USERNAME}\AppData\Roaming\Composer\vendor\bin
Note to readers: The above assumes that you're running windows, and that you've installed Java/Composer in that specific directory. 


(07-24-2016, 11:22 PM)Coddr Wrote: Also I really nice tutorial.

Thank you. Hat Tip

No thanks!
------
Yup this is the default install directory
Reply
#6
Just to toss a bit of more info on the subject, environmental variables are sort of like global variables in programming - they can be called from anywhere. While your PATH environmental variable on Windows boxes determines where windows searches for a program if you just type it's name into the console (java, perl, nodejs, etc) there are other environmental variables used by the OS. These are called system environmental variables, as the system uses them store store information on a per-machine basis.

There are also user-level environmental variables that can be configured so only a certain user might call them. For example, TEMP is the path to temporary files and folders. As this is not a shared folder, it can't be a system variable, or programs that move files to %TEMP% would be conflicting/overwriting installations of the same software by another user.

Here's a list of other system environmental variables that can be used.
Reply
#7
(07-26-2016, 12:14 PM)Albus Wrote: Environmental variables are sort of like global variables in programming - they can be called from anywhere.

I actively chose not to mention one or two things, for the sake of sticking to my purpose. But I should have added the above quote,
seems to fit in despite how concise and non-detailed this thread is supposed to be.

I'll edit that in.

Thanks for the input Hat Tip
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)