sysconfig/npm-clear-all.bat
2022-12-05 16:38:05 +08:00

61 lines
1.4 KiB
Batchfile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@echo off
@REM 首先清除可能残留的变量
set FONPATH=
@ if not "" == "%1" (
set FONPATH=%1
) else (
if exist D:\faronear (
set FONPATH=D:\faronear
) else (if exist C:\faronear (
set FONPATH=C:\faronear
) else (if exist %HOMEDRIVE%%HOMEPATH%\faronear (
set FONPATH=%HOMEDRIVE%%HOMEPATH%\faronear
) else (
echo === Enter [target path] or leave [blank] for default to `.`
set /p FONPATH=">>> "
echo;
if "" == "%FONPATH%" (
set FONPATH=.
)
)))
)
if not exist "%FONPATH%" (
echo *** [%FONPATH%] not exist! Exit now. ***
@ GOTO END
)
pushd %FONPATH%
echo *** Starting from [%CD%] ***
echo;
@REM for /d %%d in (*) do ( pushd %%d & ( for /d %%d in (*) do ( if exist %%d/.git pushd %%d & echo --- git pulling: %%d ... & git pull & popd ) ) & popd )
for /d %%o in (*) do (
@REM windows的链接文件会造成路径错误从而终止该循环从而导致下一轮乃至所有循环的工作目录错误。因此要过滤掉 .vscode 这个符号链接目录。
@ if not "%%o" == ".vscode" (
echo ======== entering [%FONPATH%\%%o] ========
echo;
pushd %%o
for /d %%g in (*) do (
if exist %%g\node_modules (
pushd %%g
echo ---- Deleting [%%g\node_modules] ----
rd /s /q node_modules
echo;
popd
)
)
popd
)
)
popd
pause
@GOTO END
:END