上传文件至 /
This commit is contained in:
parent
be3e010af0
commit
89622382f3
33
add_path.bat
Normal file
33
add_path.bat
Normal file
@ -0,0 +1,33 @@
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
:: 获取当前脚本所在的目录
|
||||
set "scriptPath=%~dp0"
|
||||
|
||||
:: 读取 env.txt 文件
|
||||
set "envFile=%scriptPath%env.txt"
|
||||
if not exist "%envFile%" (
|
||||
echo 未找到 env.txt 文件,请检查文件是否存在。
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: 保存原始的 PATH 环境变量
|
||||
set "originalPath=%PATH%"
|
||||
|
||||
:: 读取 env.txt 文件中的每一行并将路径添加到 PATH 的前面
|
||||
for /f "usebackq delims=" %%p in ("%envFile%") do (
|
||||
set "fullPath=%scriptPath%%%p"
|
||||
set "PATH=!fullPath!;!PATH!"
|
||||
)
|
||||
|
||||
echo 以下路径已添加到 PATH 的前面:
|
||||
for /f "usebackq delims=" %%p in ("%envFile%") do (
|
||||
set "fullPath=%scriptPath%%%p"
|
||||
echo !fullPath!
|
||||
)
|
||||
|
||||
:: 启动一个新的 cmd 窗口,并继承修改后的 PATH 环境变量
|
||||
start cmd /k "echo 已继承修改后的 PATH 环境变量 & echo."
|
||||
|
||||
:: 保持当前窗口
|
||||
echo 新的 cmd 窗口已打开,继承了修改后的环境变量。
|
Loading…
Reference in New Issue
Block a user