@echo off
echo 添加HySim环境变量:
set regpath=HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment set evname=HySim_Matlab_exe
set exepath=c:\java\jdk
reg add "%regpath%" /v %evname% /d %exepath% /f
pause>nul
::删除环境变量JAVA_HOME
@echo off
echo 删除java环境变量
set regpath=HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment set evname=JAVA_HOME
reg delete "%regpath%" /v "%evname%" /f
pause>nul
@echo off
echo 判断环境变量是否存在,不存在就添加
@set Path_=D:\Program Files
for,/f,"skip=4 tokens=1,2,*",%%a,in,('reg query
"HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment" /v Path'),do,( @set PathAll_=%%c
)
echo %PathAll_%|find /i "%Path_%" && set IsNull=true|| set IsNull=false
java系统变量设置if not %IsNull%==true (
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment" /v Path /t REG_EXPAND_SZ /d "%PathAll_%;%Path_%" /f
)
pause
file:///E/Job/参考资料/批处理/批处理-环境变量设置.txt[2018/3/31 8:25:51]
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论