| @echo off | |
| setlocal enabledelayedexpansion | |
| cd /d "%~dp0" | |
| set "target_dir=%~dp0" | |
| set "custom_n=%target_dir%ComfyUI\custom_nodes" | |
| set "PATH=%PATH%;%target_dir%git\git\bin;%target_dir%git\git\libexec;%target_dir%python;%target_dir%\python\Library\bin;%target_dir%python\Scripts" | |
| set "git=%target_dir%git\git\bin\git" | |
| echo Checking and updating repositories in custom_nodes folder... | |
| for /d %%D in ("%custom_n%\*") do ( | |
| if exist "%%D\.git" ( | |
| echo Updating %%~nxD... | |
| cd "%%D" | |
| %git% fetch | |
| for /f %%i in ('%git% rev-list HEAD...origin/main --count') do set "commits=%%i" | |
| if !commits! neq 0 ( | |
| echo %%~nxD is !commits! commits behind. Updating... | |
| %git% pull | |
| echo %%~nxD updated successfully. | |
| ) else ( | |
| echo %%~nxD is up to date. | |
| ) | |
| cd .. | |
| ) | |
| ) | |
| echo Updating main ComfyUI repository... | |
| cd "%target_dir%ComfyUI" | |
| %git% pull | |
| echo Updating Python packages... | |
| "%target_dir%python\python.exe" -s -m pip install --upgrade torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121 -r "%target_dir%ComfyUI/requirements.txt" pygit2 | |
| echo All updates completed. | |
| pause |