What are the variables in the command line environment?
  • one
    Much for what. To shorten the string due to the contents of the variable, to create scripts, to transfer data to the called applications ... - alexlz

2 answers 2

Environment variables allow you to do without specifying absolute paths to directories. For example, if we do not know in advance the letter of the system drive, we can always use the variable %systemdrive% , which returns the drive letter on which the OS is installed. Also, variables are used to optimize the code - a multiple variable (for example, a registry key) can be assigned a short variable and used.

    The answer is in the question itself - is it a variable? Three typical change examples can change:

    1) As written above - environment variables. On different PCs, standard files or folders may be located in different places, for example, in Windows OS, the% WINDIR% environment variable points to the folder where the OS is installed

    2) Session variables - if you need to find the current user's folder, then in the same Windows it is the% UserProfile% variable, which in turn consists of the environment variable, the constant and the session variable:% SystemDrive% \ Users {username}

    3) Just variables - needed when something needs to be changed - if you want to run a cycle a hundred times - you do not have to run a command a hundred times - counter variable to help, you want to use the result of the application’s cli calculation for the next calculation - make it variable, etc.