Luis-Filipe's picture
Upload 433 files
6bfcd28 verified
@Echo off&&cd /D %~dp0
Title ComfyUI-Easy-Install NEXT (Reinstall Mode B – Replace Only)
:: Set Python version
set "PYTHON_VERSION=3.12"
:: Colors
set warning=[33m
set red=[91m
set green=[92m
set yellow=[93m
set bold=[1m
set reset=[0m
:: Arguments
set "PIPargs=--no-cache-dir --no-warn-script-location --timeout=1000 --retries 200"
set "CURLargs=--retry 200 --retry-all-errors"
set "UVargs=--no-cache --link-mode=copy"
echo %green%=== ComfyUI Reinstall (Mode B: Replace Only) ===%reset%
echo.
:: Ensure folder exists
if not exist ComfyUI-Easy-Install (
echo %red%ERROR:%reset% Folder ComfyUI-Easy-Install not found!
pause
exit /b
)
cd ComfyUI-Easy-Install
:: -----------------------------
:: REINSTALL PYTHON EMBEDDED
:: -----------------------------
echo %yellow%Replacing python_embeded...%reset%
if not exist python_embeded md python_embeded
:: Download correct Python version
if "%PYTHON_VERSION%"=="3.11" (set "PYTHON_VER=3.11.9")
if "%PYTHON_VERSION%"=="3.12" (set "PYTHON_VER=3.12.10")
cd python_embeded
del /q * >nul 2>&1
curl.exe -OL https://www.python.org/ftp/python/%PYTHON_VER%/python-%PYTHON_VER%-embed-amd64.zip --ssl-no-revoke %CURLargs%
tar.exe -xf python-%PYTHON_VER%-embed-amd64.zip
del python-%PYTHON_VER%-embed-amd64.zip
curl.exe -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py --ssl-no-revoke %CURLargs%
:: Create .pth
echo ../ComfyUI> python312._pth
echo python312.zip>> python312._pth
echo .>> python312._pth
echo Lib/site-packages>> python312._pth
echo Lib>> python312._pth
echo Scripts>> python312._pth
echo # import site>> python312._pth
.\python.exe -I get-pip.py %PIPargs%
.\python.exe -I -m pip install uv %PIPargs%
cd ..
:: -----------------------------
:: REINSTALL COMFYUI FILES ONLY
:: -----------------------------
echo %yellow%Updating ComfyUI core files...%reset%
if not exist ComfyUI md ComfyUI
:: Clone to temp folder
git.exe clone https://github.com/comfyanonymous/ComfyUI ComfyUI_NEW
:: Copy only core folders (replace)
xcopy ComfyUI_NEW\comfy ComfyUI\comfy /E /Y /I /Q
xcopy ComfyUI_NEW\app ComfyUI\app /E /Y /I /Q
xcopy ComfyUI_NEW\web ComfyUI\web /E /Y /I /Q
xcopy ComfyUI_NEW\api_server ComfyUI\api_server /E /Y /I /Q
xcopy ComfyUI_NEW\comfy_api ComfyUI\comfy_api /E /Y /I /Q
xcopy ComfyUI_NEW\comfy_api_nodes ComfyUI\comfy_api_nodes /E /Y /I /Q
xcopy ComfyUI_NEW\utils ComfyUI\utils /E /Y /I /Q
:: Replace main files
copy /Y ComfyUI_NEW\main.py ComfyUI\
copy /Y ComfyUI_NEW\server.py ComfyUI\
copy /Y ComfyUI_NEW\execution.py ComfyUI\
copy /Y ComfyUI_NEW\folder_paths.py ComfyUI\
copy /Y ComfyUI_NEW\comfyui_version.py ComfyUI\
copy /Y ComfyUI_NEW\requirements.txt ComfyUI\
:: Remove temp clone
rmdir /s /q ComfyUI_NEW
:: -----------------------------
:: INSTALL REQUIREMENTS
:: -----------------------------
echo %yellow%Installing requirements...%reset%
.\python_embeded\python.exe -I -m uv pip install -r ComfyUI\requirements.txt %UVargs%
:: -----------------------------
:: REINSTALL ADDITIONAL NODES (NO DELETE)
:: -----------------------------
echo %yellow%Installing extra nodes (non-destructive)...%reset%
call :get_node https://github.com/Comfy-Org/ComfyUI-Manager comfyui-manager
call :get_node https://github.com/WASasquatch/was-node-suite-comfyui was-node-suite-comfyui
call :get_node https://github.com/yolain/ComfyUI-Easy-Use ComfyUI-Easy-Use
call :get_node https://github.com/Fannovel16/comfyui_controlnet_aux comfyui_controlnet_aux
echo %green%=== Reinstall Complete (Mode B) ===%reset%
pause
exit /b
:get_node
set git_url=%~1
set git_folder=%~2
echo Installing %git_folder%...
if not exist ComfyUI\custom_nodes md ComfyUI\custom_nodes
git.exe clone %git_url% ComfyUI\custom_nodes\%git_folder% 2>nul
if exist ComfyUI\custom_nodes\%git_folder%\requirements.txt (
.\python_embeded\python.exe -I -m uv pip install -r ComfyUI\custom_nodes\%git_folder%\requirements.txt %UVargs%
)
echo.
goto :eof