-
Environment Variables
Environment variables (environment variables) are typically used in the operating system to specify the operating system environment of some parameters, such as: temporary folder location and System folder location. An environment variable is an object with a specific name in the operating system that contains the information that one or more applications will use. For example, the PATH environment variable in Windows and DOS operating system, when the system is required to run a program without telling it the full path of the program, in addition to the current directory in the search for this program, but also in path specified in the path to find. The user can run the process better by setting the environment variables.
-
Chinese name
-
Environment variables
-
Foreign names
-
Environment Variables
-
Applied Disciplines
-
Computer software
-
Properties
-
Objects Object
setting parameters Environment variables are equivalent to some of the parameters that are set up for a system or user application, which is of course related to the specific environment variables. For example, path, is to tell the system, when the system is required to run a program without telling it the full path of the program, in addition to the current directory in the search for this program, but also to find out which directories to go down, such as TC or VC + +, set include=path1;path2; is to tell the compiler where to find the. h type of file; Of course not just specifying what path, but also other functions, such as set DIRCMD=/4 setting an environment variable is used when using the dir command to add/4 as the default parameter after your dir command, Just like your every command adds the/4 parameter, which is actually an environment variable set for command interpreter commands, and is set for the internal command of Dir. Dword getenvironmentvariable (LPCSTR lpname, LPSTR lpbuffer, DWORD dsize), parameter lpname is the name of the environment variable you asked to query, Lpbuffer is to return the value of the environment variable you specified, Dsize tells the function how many bytes lpbuffer can hold. The reason for parsing a local failure is most likely due to the fact that the default path in the environment variable is deleted, and once the default path is set, the current system needs some DLL or EXE file when the program is running, and the active control goes to all default paths when it is run. If you find the appropriate program in these directories is automatically loaded, you cannot find the error message that the xxx file is missing. Software common many friends install a dual system on their own computer, such as the C-drive installation Windows xp,d disk installation Windows 7. However, some software is often installed only in Windows XP system, Windows 7 system is not working properly, the more troublesome but effective way is to install again. When we understand the use of environment variables, we can solve the problem of software sharing of dual systems well. Why does the system run under Windows 7 when the software installed in Windows XP does not work (except for green software)? The reason is that some files are often required to be copied to the system directory when installing the software, while another system cannot run because of the missing files. Therefore, we can solve this problem by setting the environment variable. Common environment variables The Windows system%allusersprofile% locally returns the location of all user profiles. %appdata% Local returns the location by default where the application stores data. %cd% returns the current directory string locally. %cmdcmdline% Partial returnReturns the exact command line used to start the current Cmd.exe. The%cmdextversion% system returns the version number of the current command handler extension. The%computername% system returns the name of the computer. The%comspec% system returns the exact path to the command-line interpreter executable program. The%date% system returns the current date. Use the same format as the date/t command. Generated by Cmd.exe. For more information about the date command, see date. The%errorlevel% system returns the error code of the used command. Errors are usually indicated by a value other than 0. The%homedrive% system returns the local workstation drive letter that is connected to the user's home directory. Settings based on the home directory value. The user home directory is specified in Local Users and groups. The%homepath% system returns the full path of the user's home directory. Settings based on the home directory value. The user home directory is specified in Local Users and groups. The%homeshare% system returns the network path of the user's shared home directory. Settings based on the home directory value. The user home directory is specified in Local Users and groups. %logonsever% Local returns the name of the domain controller that validates the current logon session. The%number_of_processors% system specifies the number of processors installed on the computer. The%os% system returns the name of the operating system. Windows 2000 displays the operating system as WINDOWS_NT. The%PATH% system specifies the search path for the executable file. The%pathext% system returns a list of file name extensions that the operating system considers executable. The%processor_architecture% system returns the chipset architecture of the processor. Value: X86,ia64. The%processor_identifier% system returns the processor description. The%processor_level% system returns the model number of the processor installed on the computer. The system variable that returns the processor revision number for the%processor_revision% system. %prompt% returns the command prompt settings for the current interpreter locally. Generated by Cmd.exe. The%random% system returns any decimal digits from 0 to 32767. Generated by Cmd.exe. The%systemdrive% system returns a drive that contains the Windows XP root directory, which is the system root. The%SYSTEMROOT% system returns the location of the Windows XP root directory. %temp% and%TMP% systems and users return to the applications that are available to the currently logged-on userThe default temp directory. Some applications require TEMP, while other applications require TMP. The%time% system returns the current time. Use the same format as the time/t command. Generated by Cmd.exe. For more information about the time command, see time. %userdomain% Local returns the name of the domain that contains the user account. %USERNAME% Local returns the name of the currently logged-on user. %UserProfile% Local Returns the location of the current user's profile. The%WINDIR% system returns the location of the operating system directory. The Linux system shell environment relies on the settings of multiple files. When the shell is called, it reads the command from both initial files. The/etc/profile contains system variables, which are maintained by the system administrator, and are set by system administrators for local system variables and special commands. The Startup information file ($HOME/.bash_project) of the ordinary user is maintained by the individual user, and the file can be modified to implement any particular system initialization. The profile is read only under certain circumstances, specifically when the user logs in. When you run a shell script or subshell, you do not need to read the profile. Although all profiles are optional, basically all systems have/etc/profile. If the variable env is defined and is passed to the environment, all bash The shell reads and invokes the commands contained in the file created by this variable. This file is used to define the features of all bash shells, not just to the shell. The typical name of this file is $HOME/,BASHRC. When you create a new user with (System administrator), the. Bash_profile, BASHRC, and other public environment file templates are copied to the/etc/skel directory. You can edit these initialization settings, or you can add additional files under this directory. Example: A typical system profile (/etc/profile):P ath= $PATH:/usr/qa/tools/binenv== $HOME/.bashrcoracle_home=/dbs/ Oracleoracle_sid=qadbexport PATH ENV oracle_home orcal_sidcat/etc/motd A typical user profile (. bashrc) path= $PATH: $HOME/ binteam=uvt1224 export Termsttyintr \^ccalmesg n A typical user bashrC file (. bashrc): Alias Dir=ls lf= ' ls-fc ' psi= ' $PWS [!] > ' Set-o vi Aliases and other bash-specific definitions should be placed in. bashrc files (should not be defined in. bash_profile), otherwise it will result in some commands not being found. You should remember the difference between the profile file and the. bashrc file: Two profiles are read only once at system startup, while. BASHRC is read when the system starts and every time the shell is called. The Setup method can be set in the Windows operating system through my Computer-〉 System Properties-〉 advanced system settings-environment variables, setting the environment variables, but whether the environment variables set in the registry have corresponding entries? The answer is yes. In. NET, a class is provided to get the system's environment variables and their values. Environment variables are divided into two categories: User variables and system variables, which have corresponding entries in the registry. Where the user variable is located: hkey_current_user\environment; The system variable is located at: \hkey_local_machine\system\controlset001\control\session Manager\Environment. Alternatively, you can right-click My Computer-Advanced system settings-environment variables-in the system variable has the path option-double-hit open-on the basis of the original variable to add a semicolon under the English state-and then enter the path name. (Remember, do not delete the original system variables, as long as they are separated by semicolons, and then add, and finally a semicolon) editing methods to edit the environment variables on the command line view all currently available environment variables (= System variables + user variables) set to view an environment variable, such as Pathset PATH adds an environment variable, such as Xxx=aaset Xxx=aa, to set the value of an environment variable (such as XXX) to an empty set xxx= add a new value (such as d:\xxx) after an environment variable (such as PATH) set path=%path%;d: \ XXX (Note: The operation of the environment variable in a DOS window is only valid for the application of the current window)
What is an environment variable