@echo off
set QTPATH=E:\baktest
Path|find "%QTPATH%\2017"
if "%ERRORLEVEL%"=="0" goto :run1
wmic ENVIRONMENT where "name='Path' and username='<system>' " set VariableValue="%path%;%QTPATH%\2017"
参考自:https://zhidao.baidu.com/question/306123351781463924.html