1. 避免多次重复设置或着修改系统环境变量。
@echo off
set JAVA_HOME=C:\Users\Desktop\JRE1.6.0.30set M2_HOME=C:\Users\............
@rem %M2_HOME%\ to run any bat you want use JAVA_HOME=C:\Users\Desktop\JRE1.6.0.30.
2.设置当前用户环境变量。
Search "env" in sys Search. find out Environment Variables dialog.
Cope all the path value in System variables and create a new path in User variables then past the cope value. Then you can do what ever you want in User's path.