当前位置:网站首页>通过bat脚本配置系统环境变量
通过bat脚本配置系统环境变量
2022-07-06 09:04:00 【vv1025】
通过bat脚本配置系统环境变量
@echo off
echo ---------------------------------------
set pan=%~d0
set filePath=%~p0
set filePath=%pan%%filePath%
echo current path: %filePath%
REM 添加PATH环境变量:如果已经存在则不添加
echo ---------------------------------------
SET add_path=
SET toAdd=%~dp0
SET MYPATHCOPY=%PATH%
call :search1
echo %add_path%
SET toAdd=C:\Program Files\Go\bin
SET MYPATHCOPY=%PATH%
call :search2
echo %add_path%
echo add the path: %add_path%
call set xx=%Path%;%add_path%
wmic ENVIRONMENT where "name='Path' and username='<system>'" set VariableValue="%xx%"
pause
REM TIMEOUT /T 10
REM 方法1
:search1
for /f "tokens=1* delims=;" %%a in ("%MYPATHCOPY%") do (
if "%toAdd%"=="%%a" (
goto :isFinded
)
set MYPATHCOPY=%%b
goto :search1
)
set add_path=%toAdd%;%add_path%
goto :EOF
REM 方法2
:search2
for /f "delims=; tokens=1,2*" %%p in ("%MYPATHCOPY%") do (
REM @echo %%~p
SET MYPATHCOPY=%%~q;%%~r
if "%toAdd%"=="%%p" (
REM echo %%p
goto :isFinded
)
goto :search2
)
set add_path=%toAdd%;%add_path%
goto :EOF
:isFinded
echo The path already exists: %toAdd%
goto :EOF
边栏推荐
- [deep learning] semantic segmentation: paper reading: (2021-12) mask2former
- MapReduce instance (VII): single table join
- Solve the problem of too many small files
- 有软件负载均衡,也有硬件负载均衡,选择哪个?
- Why can't TN-C use 2p circuit breaker?
- 五月刷题01——数组
- [deep learning] semantic segmentation: thesis reading (neurips 2021) maskformer: per pixel classification is not all you need
- CANoe的数据回放(Replay Block),还是要结合CAPL脚本才能说的明白
- Publish and subscribe to redis
- [deep learning] semantic segmentation - source code summary
猜你喜欢

Design and implementation of film and television creation forum based on b/s (attached: source code paper SQL file project deployment tutorial)

机械工程师和电气工程师方向哪个前景比较好?

大学想要选择学习自动化专业,可以看什么书去提前了解?

Take you back to spark ecosystem!
[Yu Yue education] Wuhan University of science and technology securities investment reference

工作流—activiti7环境搭建

英雄联盟轮播图手动轮播

MapReduce instance (VIII): Map end join

What are the models of data modeling

零基础学习单片机切记这四点要求,少走弯路
随机推荐
Cap theory
068.查找插入位置--二分查找
MapReduce instance (V): secondary sorting
Mapreduce实例(九):Reduce端join
Summary of May training - from a Guang
Global and Chinese market of appointment reminder software 2022-2028: Research Report on technology, participants, trends, market size and share
[deep learning] semantic segmentation - source code summary
Une grande vague d'attaques à la source ouverte
Learning SCM is of great help to society
Global and Chinese market of metallized flexible packaging 2022-2028: Research Report on technology, participants, trends, market size and share
Sqlmap installation tutorial and problem explanation under Windows Environment -- "sqlmap installation | CSDN creation punch in"
018. Valid palindromes
O & M, let go of monitoring - let go of yourself
Use of activiti7 workflow
Global and Chinese market of cup masks 2022-2028: Research Report on technology, participants, trends, market size and share
[deep learning] semantic segmentation: paper reading: (CVPR 2022) mpvit (cnn+transformer): multipath visual transformer for dense prediction
[Yu Yue education] Wuhan University of science and technology securities investment reference
在CANoe中通过Panel面板控制Test Module 运行(高级)
Global and Chinese market of electronic tubes 2022-2028: Research Report on technology, participants, trends, market size and share
MapReduce instance (VI): inverted index