Set the system environment variables permanently in the setx.exe command line mode in ipvs.

Source: Internet
Author: User
Setx.exe is not a default command provided by the system, but it can be downloaded from Microsoft's website (2 K, XP). It is an official example, so you can use it with confidence. Here is the exe file I extracted from the 2 k Installation File. If you do not want to install it, you can download it if you trust me.

The following is how it is used:

※Source:. Yat-sen Channel bbs.zsu.edu.cn.

Setx

Set environment variables locally or in the system environment, without the need to write programs or make scripts. Setx also retrieves the registry key and writes it to a text file.

Syntax
Setx [/s Computer [/u [Domain \] User [/p [Password] Variable Value [/m]

Setx [/s Computer [/u [Domain \] User [/p [Password] [Variable]/k Path [/m]

Setx [/s Computer [/u [Domain \] User [/p [Password]/f FileName {[Variable] {/a X, y |/r X, y "Stri
Ng "} [/m] |/x} [/d Delimiters]

Parameters
/S Computer
Specify the remote computer name or IP address (the backslash cannot be used ). The default value is local computer. This parameter applies to all
Files and folders.
/U [Domain \] User
Run the script with the permissions of a specific user account. The default value is system permission.
/P [Password]
Specifies the password of the user account specified in the/u parameter.
Variable
Specifies the name of the environment variable to be set.
Value
Specifies the value of the environment variable to be set.
/K Path
Specify to set variables based on information from the registry key. Specify Path in the format of \ HIVE \ KEY \... \ Value (for example, HKEY_LOCAL_MACHINE \
System \ CurrentControlSet \ Control \ TimeZoneInformation \ StandardName ).
/F FileName
Specifies the file to be used.
/A X, y
Specify the absolute coordinates and offset as the search parameters.
/R X, y "String"
Specify the relative coordinates and offset from the String as the search parameter.
/M
Specify to set Variable in the system environment. The default value is the local environment.
/X
Displays the file coordinates. Ignore the/a,/r, And/d command line options.
/D Delimiters
Specify the additional separator, for example, "," or "\". The four built-in delimiters are space, grid key, carriage return, and line break. Any ASCII characters can be used.
Separator. The maximum delimiter value is 15, including four built-in delimiters.
/?
Display help at a command prompt.
Note
Use the/s,/u, And/p command line options

The/u and/p options can be used only when the/s command line option is used. You must use both/p and/u to provide the user password.
Setx allows you to set system environment values directly and permanently only through command line or programming. System environment variables can be registered through the control panel or through
Manually configure the table editor (Regedit.exe. Set command is the internal command of the command interpreter (that is, cmd.exe), only for the current Console window
Set user environment variables.
You can use setx to set values for users and system environment variables from one of the following sources: command line mode, registry mode, or file mode.
Setx is similar to the UNIX utility SETENV.
Setx writes the variable to the master environment in the registry. Variables set with setx are only available in future command windows, rather than in current command windows.
.
Only the HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE configuration units are supported. REG_DWORD, REG_EXPAND_SZ, REG_SZ AND REG_MU
LTI_SZ is a valid RegKey data type.
When you obtain access to the REG_MULTI_SZ value in the registry, only the first item is expanded and used.
You cannot use setx to delete values added to the local environment or system environment. You can use a set with a variable name but no value to delete the corresponding
Value.
The registry value of REG_DWORD is expanded and used in hexadecimal mode.
File mode only supports parsing CR-LF text files.
Example
To set the MACHINE environment variable to Brand1 in the local environment, type:

Setx MACHINE brand1

To set the MACHINE environment variable to Brand1 Computer in the system environment, type:

Setx MACHINE "brand1 computer"/m

To set the MYPATH environment variable in the local environment to use the search PATH defined in the PATH environment variable, type:

Setx MYPATH % PATH %

To set the MYPATH environment variable in the local environment ~ Replace with % and use the search PATH defined in the PATH environment variable. Type
:

Setx MYPATH ~ PATH ~

To set the MACHINE environment variable to BRAND1 in a local environment on a computer named Computer1, type:

Setx/s computer1/u maindom \ hiropln/p @ ssW23 MACHINE BRAND1

You need to set the MYPATH environment variable in the local environment on a computer named Computer1 to use the search defined in the PATH environment variable.
Path, enter:

Setx/s computer1/u maindom \ hiropln/p @ ssW23 MYPATH % PATH %

In the local environment, set the TZONE environment variable to HKEY_LOCAL_MACHINE \ System \ CurrentControlSet \ Control \ TimeZone.
For the value found in the Information \ StandardName registry key, type:

Setx TZONE/k HKEY_LOCAL_MACHINE \ System \ CurrentControlSet \ Control \ TimeZoneInformation \ StandardName

Set the BUILD environment variable to HKEY_LOCAL_MACHINE \ Software \ Microsoft \ WindowsNT \ CurrentVersi in the system Environment
For the value found in the on \ CurrentBuildNumber registry key, type:

Setx BUILD/k "HKEY_LOCAL_MACHINE \ Software \ Microsoft \ WindowsNT \ CurrentVersion \ CurrentBuildNumber"/m


In the local environment of a computer named Computer1, set the TZONE environment variable to HKEY_LOCAL_MACHINE \ System \ Cu.
The value found in the rrentControlSet \ Control \ TimeZoneInformation \ StandardName registry key. Type:

Setx/s computer1/u maindom \ hiropln/p @ ssW23 TZONE/k HKEY_LOCAL_MACHINE \ System \ CurrentControlSe
T \ Control \ TimeZoneInformation \ StandardName

In the system environment of a computer named Computer1, set the BUILD environment variable to HKEY_LOCAL_MACHINE \ Software \ M.
The value found in the icrosoft \ WindowsNT \ CurrentVersion \ CurrentBuildNumber registry key. Type:

Setx/s computer1/u maindom \ hiropln/p @ ssW23 BUILD/k "HKEY_LOCAL_MACHINE \ Software \ Microsoft \ Wind
Ows NT \ CurrentVersion \ CurrentBuildNumber "/m

To display the content of the file ipconfig. out and its corresponding coordinates, type:

Setx/f ipconfig. out/x

To set the IPADDR environment variable to the value found at the coordinates of 5 and 11 in the ipconfig. out file in the local environment, type:

Setx IPADDR/f ipconfig. out/a 5, 11

In the local environment, set the OCTET1 environment variable to the value found at the 5 or 3 coordinates in the ipconfig. out file with the separator "# $,
Enter:

Setx OCTET1/f ipconfig. out/a 5, 3/d "# $ *."

In the local environment, you need to set the IPGATEWAY environment variable to find the coordinates in the ipconfig. out file relative to the coordinates of "Gateway".
Enter:

Setx IPGATEWAY/f ipconfig. out/r 0, 7 Gateway

To display the file ipconfig. out and its corresponding coordinates on a computer named Computer1, type:

Setx/s computer1/u maindom \ hiropln/p @ ssW23/f ipconfig. out/x

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.