::添加环境变量 BAT_HOME
@echo off
echo 添加 bat 环境变量
set regpath=HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
set evname=MAVEN_HOME_TEMP
set batpath=D:\java\apache-maven-3.8.4
reg add "%regpath%" /v %evname% /d %batpath% /f
pause>nul
::删除环境变量 BAT_HOME
@echo off
echo 删除 bat 环境变量
set regpath=HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
set evname=BAT_HOME
reg delete "%regpath%" /v "%evname%" /f
pause>nul
标签:BAT,set,Java,windows,echo,环境变,HOME,环境变量
From: https://www.cnblogs.com/sopcce/p/17052840.html