![]() Set or change the value of the variable (Note: no space before and after '=')ĭelete the variable by setting to empty string (Note: nothing after '=')įor examples, // Set an environment variable called MY_VAR set MY_VAR=hello // Display set MY_VAR MY_VAR=hello // Unset an environment variable set MY_VAR= // Display set MY_VAR Environment variable MY_VAR not definedĪn environment variable set via the " set" command under CMD is a local, available to the current CMD session only. set varname set varname = value set varname = set To unset an environment variable, use " set varname=", i.e., set it to an empty string. There shall be no spaces before and after the '=' sign. To set (or change) a environment variable, use command " set varname= value". ![]() To display a particular variable, use command " set varname", or " echo % varname%": // Display a particular variable set COMPUTERNAME COMPUTERNAME=xxxxxx // or, use "echo" command with variable name enclosed within a pair of '%' echo %COMPUTERNAME% COMPUTERNAME=xxxxxx Set/Unset/Change an Environment Variable for the "Current" CMD Session Pay particular attention to the variable called PATH. Try issuing a " set" command on your system, and study the environment variables listed. To list ALL the environment variables and their values, start a CMD and issue the command " set", as follows, // Display all the variables (in NAME=VALUE pairs) set COMPUTERNAME=xxxxxxx Display Environment Variables and their Values They are typically named in uppercase, with words joined with underscore ( _), e.g., JAVA_HOME. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |