Setting Windows environment variables by modifying the registry

Source: Internet
Author: User

Development environment to set up a lot of environment variables each time, generally through the "menu", "Computer", "Properties", "Environment variables" and "Settings", re-install the system, each time to set a lot of environment variables, very troublesome. You can actually set the environment variable by modifying the registry, and set it up once with the bat script.

First set the user environment variable to Path =%devpaths%;

Create a bat script that adds the bin directory of tools such as Java, Maven, and so on to%devpaths%.

SetEnv.bat

REG ADD "hkcu\environment"/f/t reg_sz/v java_home/d "D:\dev\jdk8_32""hkcu\environment"/f/t reg_sz/v Mvn_ho  me/d "D:\dev\maven""hkcu\environment"/f/t reg_sz/v ant_home/d "D:\dev\ant""Hkcu\environment"/f/t reg_sz/v gradle_home/d "D:\dev\gradle-3.4.1""hkcu\environment"/f/t reg_sz/v groovy_home/d "D:\dev\groovy" c4>"hkcu\environment"/f/t reg_sz/v erlang_home/d "C:\Program files\erl9.2""hkcu\environment"/f/t REG_ expand_sz/v devpaths/d "%java_home%\bin;%mvn_home%\bin;%ant_home%\bin;%groovy_home%\bin;%gradle_home%\bin;% Erlang_home%\bin "


Modify the values in the registry by using the Reg command. The user's environment variables are under Hkcu\enviroment, HKCU represents Key_current_user.

Values with a percent reference need to set the/T REG_EXPAND_SZ type so that Chengxiang strings can be expanded, such as the devpaths above.

Setting Windows environment variables by modifying the registry

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.