mirror of
https://github.com/cmderdev/cmder.git
synced 2025-11-09 05:39:03 +08:00
Compare commits
2 Commits
master
...
copilot/su
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7510436f7d | ||
|
|
f6eb7aa4f8 |
29
vendor/lib/lib_path.cmd
vendored
29
vendor/lib/lib_path.cmd
vendored
@@ -91,13 +91,13 @@ exit /b
|
|||||||
|
|
||||||
if /i "!position!" == "append" (
|
if /i "!position!" == "append" (
|
||||||
if "!found!" == "0" (
|
if "!found!" == "0" (
|
||||||
echo "!PATH!"|!WINDIR!\System32\findstr >nul /I /R /C:";!find_query!\"$"
|
echo "!PATH!"|!WINDIR!\System32\findstr >nul /I /R /C:";!find_query!$"
|
||||||
call :set_found
|
call :set_found
|
||||||
)
|
)
|
||||||
%print_debug% :enhance_path "Env Var END PATH !find_query! - found=!found!"
|
%print_debug% :enhance_path "Env Var END PATH !find_query! - found=!found!"
|
||||||
) else (
|
) else (
|
||||||
if "!found!" == "0" (
|
if "!found!" == "0" (
|
||||||
echo "!PATH!"|!WINDIR!\System32\findstr >nul /I /R /C:"^\"!find_query!;"
|
echo "!PATH!"|!WINDIR!\System32\findstr >nul /I /R /C:"^!find_query!;"
|
||||||
call :set_found
|
call :set_found
|
||||||
)
|
)
|
||||||
%print_debug% :enhance_path "Env Var BEGIN PATH !find_query! - found=!found!"
|
%print_debug% :enhance_path "Env Var BEGIN PATH !find_query! - found=!found!"
|
||||||
@@ -190,13 +190,28 @@ exit /b
|
|||||||
exit /b 1
|
exit /b 1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
rem Parse arguments robustly:
|
||||||
|
rem Accept either public form: "[dir_path]" [max_depth] [append]
|
||||||
|
rem or internal recursive form: "[dir_path]" [depth] [max_depth] [append]
|
||||||
set "depth=%~2"
|
set "depth=%~2"
|
||||||
set "max_depth=%~3"
|
set "max_depth=%~3"
|
||||||
|
set "position="
|
||||||
|
|
||||||
if "%~4" neq "" if /i "%~4" == "append" (
|
if /i "%~4" == "append" set "position=append"
|
||||||
set "position=%~4"
|
if /i "%~3" == "append" (
|
||||||
) else (
|
set "position=append"
|
||||||
set "position="
|
set "max_depth="
|
||||||
|
)
|
||||||
|
|
||||||
|
if not defined depth set "depth=0"
|
||||||
|
if not defined max_depth (
|
||||||
|
if defined depth (
|
||||||
|
rem If only one numeric argument provided, treat it as max_depth
|
||||||
|
set "max_depth=%depth%"
|
||||||
|
set "depth=0"
|
||||||
|
) else (
|
||||||
|
set "max_depth=1"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
dir "%add_path%" 2>NUL | findstr -i -e "%find_pathext%" >NUL
|
dir "%add_path%" 2>NUL | findstr -i -e "%find_pathext%" >NUL
|
||||||
@@ -232,8 +247,6 @@ exit /b
|
|||||||
call :loop_depth
|
call :loop_depth
|
||||||
)
|
)
|
||||||
|
|
||||||
set "PATH=%PATH%"
|
|
||||||
|
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
:set_depth
|
:set_depth
|
||||||
|
|||||||
Reference in New Issue
Block a user