Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between user variables and system variables?

What is the difference between user variables such as PATH, TMP, etc. and system variables?

I accidentally deleted the user variable PATH. What am I supposed to do?

like image 520
rookie Avatar asked Dec 18 '10 10:12

rookie


People also ask

What is the difference between environment variables and system variables?

System properties are specified with command-line options in Java using the -Dname=value while environment variables are set in the operating system, using the EXPORT command in Unix and SET command in windows.

What are user or system environment variables?

User environment variables, as the name suggests, are environment variables that are specific to each user account. This means that the value of a variable when logged in as one user can be different than the value of the same variable when logged in as a different user on the same computer.

Do user variables override system variables?

A regular user environment variable overrides completely a system one with the same name if both exist, but only for the specific user it is specified for. However, the user path variables is treated differently. It is appended to the system path variable when evaluating, rather than completely replacing it.

What do you mean by system variable?

You can define system variables for any or all of the entries in the Systems table. The collection of variables for a system is called the system variable pool. To work with system variables, select a single system on the Systems table, then use the System Variables action. This displays the System Variables table.


2 Answers

Right-click My Computer and go to Properties->Advanced->Environmental Variables...

What's above are user variables, and below are system variables. The elements are combined when creating the environment for an application. System variables are shared for all users, but user variables are only for your account/profile.

If you deleted the system ones by accident, bring up the Registry Editor, then go to HKLM\ControlSet002\Control\Session Manager\Environment (assuming your current control set is not ControlSet002). Then find the Path value and copy the data into the Path value of HKLM\CurrentControlSet\Control\Session Manager\Environment. You might need to reboot the computer. (Hopefully, these backups weren't from too long ago, and they contain the info you need.)

like image 177
user541686 Avatar answered Oct 19 '22 22:10

user541686


Environment variables are 'evaluated' (ie. they are attributed) in the following order:

  1. System variables
  2. Variables defined in autoexec.bat
  3. User variables

Every process has an environment block that contains a set of environment variables and their values. There are two types of environment variables: user environment variables (set for each user) and system environment variables (set for everyone). A child process inherits the environment variables of its parent process by default.

Programs started by the command processor inherit the command processor's environment variables.

Environment variables specify search paths for files, directories for temporary files, application-specific options, and other similar information. The system maintains an environment block for each user and one for the computer. The system environment block represents environment variables for all users of the particular computer. A user's environment block represents the environment variables the system maintains for that particular user, including the set of system environment variables.

like image 25
Akshaya Aradhya Avatar answered Oct 20 '22 00:10

Akshaya Aradhya