当前位置:网站首页>Configure system environment variables through bat script
Configure system environment variables through bat script
2022-07-06 09:52:00 【vv1025】
adopt bat Script configuration system environment variables
@echo off
echo ---------------------------------------
set pan=%~d0
set filePath=%~p0
set filePath=%pan%%filePath%
echo current path: %filePath%
REM add to PATH environment variable : If it already exists, do not add
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 Method 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 Method 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
边栏推荐
- Research and implementation of hospital management inpatient system based on b/s (attached: source code paper SQL file)
- Elk project monitoring platform deployment + deployment of detailed use (II)
- 大学想要选择学习自动化专业,可以看什么书去提前了解?
- What are the models of data modeling
- What you have to know about network IO model
- Mapreduce实例(七):单表join
- Summary of May training - from a Guang
- Control the operation of the test module through the panel in canoe (Advanced)
- May brush question 27 - figure
- Can I learn PLC at the age of 33
猜你喜欢

Can I learn PLC at the age of 33
![《ASP.NET Core 6框架揭秘》样章发布[200页/5章]](/img/4f/5688c391dd19129d912a3557732047.jpg)
《ASP.NET Core 6框架揭秘》样章发布[200页/5章]

Learning SCM is of great help to society

PR 2021 quick start tutorial, first understanding the Premiere Pro working interface

Summary of May training - from a Guang

Several silly built-in functions about relative path / absolute path operation in CAPL script

Keep these four requirements in mind when learning single chip microcomputer with zero foundation and avoid detours
![[Yu Yue education] reference materials of complex variable function and integral transformation of Shenyang University of Technology](/img/01/8c0b8ea397c601311ae45acaaf00da.jpg)
[Yu Yue education] reference materials of complex variable function and integral transformation of Shenyang University of Technology

Solve the problem of too many small files

Sqlmap installation tutorial and problem explanation under Windows Environment -- "sqlmap installation | CSDN creation punch in"
随机推荐
CAPL 脚本对.ini 配置文件的高阶操作
MapReduce instance (VI): inverted index
通过bat脚本配置系统环境变量
Mapreduce实例(十):ChainMapReduce
[deep learning] semantic segmentation: paper reading: (CVPR 2022) mpvit (cnn+transformer): multipath visual transformer for dense prediction
Mapreduce实例(六):倒排索引
Use of activiti7 workflow
[deep learning] semantic segmentation: paper reading: (2021-12) mask2former
Summary of May training - from a Guang
51单片机进修的一些感悟
学习单片机对社会的帮助是很大的
Cap theory
leetcode-14. Longest common prefix JS longitudinal scanning method
在CANoe中通過Panel面板控制Test Module 運行(初級)
YARN组织架构
MySQL数据库优化的几种方式(笔面试必问)
MapReduce instance (IX): reduce end join
五月刷题27——图
Single chip microcomputer realizes modular programming: Thinking + example + system tutorial (the degree of practicality is appalling)
VH6501学习系列文章