- ::将路径存到CSP_HOME
- if not "%OS%"=="Windows_NT" exit
- title WindosActive
-
- cd /D %~dp0
- cd ..
- set CSP_HOME=%cd%
- set remain=%path%
- set findedtools=false
- set findedbin=false
-
- ::创建CSP_HOME环境变量
- set path_tools=%CSP_HOME%\tools
- set path_bin=%CSP_HOME%\bin
- setx /m CSP_HOME "%CSP_HOME%"
-
- ::查找环境变量中PATH的值是否已经设置,如果没有设置才设置、
- :search1
- for /f "tokens=1,2* delims= " %%a in ("%remain%") do (
- if "%path_tools%"=="%%a" (
- set findedtools=true
- )
- if "%path_bin%"=="%%a" (
- set findedbin=true
- )
- set remain=%%b
- )
-
- if defined remain
- goto :search1
-
- if "%findedtools%"=="false" (
- if "%findedbin%"=="false" (
- setx /m PATH "%path%;%path_tools%;%path_bin%"
- ) else (
- setx /m PATH "%path%;%path_tools%"
- )
- )
- if "%findedbin%"=="true" (
- if "%findedtools%"=="false"(
- setx /m PATH "%path%;%path_bin%"
- )
- )
复制代码
|