bat文件设置环境变量

::获取管理员权限

@echo off
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
cd /d "%~dp0"

@echo off
:: 设置JDK环境变量JAVA_HOME
wmic ENVIRONMENT create name="JAVA_HOME",username="<system>",VariableValue="%~dp0jdk1.7.0_79"
echo %JAVA_HOME%
pause

posted @ 2019-06-13 15:38  余生以学  阅读(1874)  评论(0编辑  收藏  举报