本帖最后由 apang 于 2012-6-3 23:19 编辑
- @echo off
- wmic environment create name="JAVA_HOME",username="<system>",variablevalue="C:\Program Files\Java\jdk1.6.0_10"
- wmic environment create name="classpath",username="<system>",variablevalue=".;%%JAVA_HOME%%\lib;"
- wmic environment where (name="path" and username="<system>") get variablevalue|findstr /ic:"C:\\Program Files\\Java\\jdk1\.6\.0_10\\bin">nul
- if "%errorlevel%"=="0" echo "C:\Program Files\Java\jdk1.6.0_10\bin"路径已存在&pause&goto :eof
- wmic environment where (name="path" and username="<system>") set variablevalue="C:\Program Files\Java\jdk1.6.0_10\bin;%path%"
- pause
复制代码
|