# WI Local Image Studio — install official NVIDIA ComfyUI portable (Windows PowerShell). # Review before running. Does not require administrator privileges or modify system Python. param([string]$Destination="C:\AI",[switch]$DownloadSDXL,[switch]$Launch) $ErrorActionPreference="Stop" Write-Host "WI Local Image Studio / NVIDIA GPU preflight" -ForegroundColor Cyan try { & nvidia-smi --query-gpu=name,memory.total --format=csv,noheader } catch { throw "NVIDIA driver or nvidia-smi missing. Install/update driver first." } $seven=(Get-Command 7z -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Source -First 1) if(!$seven){foreach($candidate in @("C:\Program Files\7-Zip\7z.exe","C:\Program Files (x86)\7-Zip\7z.exe")){if(Test-Path $candidate){$seven=$candidate;break}}} if(!$seven){throw "Please install 7-Zip from https://7-zip.org/ and rerun this script."} New-Item -ItemType Directory -Force -Path $Destination | Out-Null $zip=Join-Path $Destination "ComfyUI_windows_portable_nvidia.7z" $folder=Join-Path $Destination "ComfyUI_windows_portable" if(!(Test-Path $folder)){ if(!(Test-Path $zip)){ Write-Host "Downloading latest official NVIDIA ComfyUI archive..." Invoke-WebRequest -Uri "https://github.com/comfyanonymous/ComfyUI/releases/latest/download/ComfyUI_windows_portable_nvidia.7z" -OutFile $zip } & $seven x $zip "-o$Destination" -y if($LASTEXITCODE -ne 0){throw "ComfyUI archive extraction failed"} } $models=Join-Path $folder "ComfyUI\models\checkpoints" if(!(Test-Path $models)){throw "Checkpoint directory missing. Verify official portable archive."} if($DownloadSDXL) { $file=Join-Path $models "sd_xl_base_1.0.safetensors" if(!(Test-Path $file)){ Write-Host "Downloading official Stability AI SDXL base weights (~7 GB)..." Invoke-WebRequest -Uri "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors" -OutFile $file } } $launch=Join-Path $folder "run_nvidia_gpu.bat" Write-Host "Installed in: $folder" Write-Host "Models: $models" Write-Host "Start ComfyUI with: $launch" Write-Host "Then open http://127.0.0.1:8188" Write-Host "No Forge, model weights or system Python are installed without request." if($Launch){if(!(Test-Path $launch)){throw "NVIDIA launcher missing"};Start-Process -FilePath $launch -WorkingDirectory $folder}