转:http://blog.163.com/hero_213/blog/static/39891214201022011585823/

ENVIRONMENT - 系统环境设置管理 
::获取temp环境变量 
wmic ENVIRONMENT where "name='temp'" get UserName,VariableValue 
::更改path环境变量值,新增e:\tools 
wmic ENVIRONMENT where "name='path' and username='<system>'" set VariableValue="%path%;e:\tools" 
::新增系统环境变量home,值为%HOMEDRIVE%%HOMEPATH% 
wmic ENVIRONMENT create name="home",username="<system>",VariableValue="%HOMEDRIVE%%HOMEPATH%" 
::删除home环境变量 
wmic ENVIRONMENT where "name='home'" delete

 

有上述的方法,可以编写bat文件来修环境变量,省去JAVA环境变量的每一次设置的痛苦

 

posted on 2017-01-19 14:10  shuangxinye  阅读(584)  评论(0编辑  收藏  举报