Last active
January 15, 2026 08:20
-
-
Save venetanji/c3b16a15f693503b7399e200f1d915d7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @echo off | |
| setlocal EnableExtensions EnableDelayedExpansion | |
| echo ============================================================ | |
| echo Comfy install (winget) + CUDA checks | |
| echo ============================================================ | |
| REM --- Magnet link placeholder --- | |
| REM Replace with the actual magnet you want to open after qBittorrent install. | |
| REM Keep it quoted; the script uses PowerShell to avoid cmd escaping issues. | |
| if not defined MAGNET_LINK set "MAGNET_LINK=magnet:?xt=urn:btih:REPLACE_ME" | |
| REM --- CUDA / NVIDIA checks (informational) --- | |
| echo. | |
| echo [CUDA checks] | |
| echo Checking for NVIDIA GPU... | |
| powershell -NoProfile -ExecutionPolicy Bypass -Command "try { $names=(Get-CimInstance Win32_VideoController | Select-Object -ExpandProperty Name); if(-not $names){ exit 2 }; $names | ForEach-Object { Write-Host ('GPU: ' + $_) }; if($names -match 'NVIDIA'){ exit 0 } else { exit 3 } } catch { exit 2 }" >nul | |
| set "GPU_CHECK=%ERRORLEVEL%" | |
| if "%GPU_CHECK%"=="0" ( | |
| echo Detected an NVIDIA GPU. | |
| ) else if "%GPU_CHECK%"=="3" ( | |
| echo WARNING: No NVIDIA GPU detected. CUDA acceleration may not be available. | |
| ) else ( | |
| echo WARNING: Could not query GPU info (CIM/WMI query failed). | |
| ) | |
| echo. | |
| echo Checking for nvidia-smi... | |
| where nvidia-smi >nul 2>nul | |
| if errorlevel 1 ( | |
| echo WARNING: nvidia-smi not found. NVIDIA driver may be missing, or PATH not set. | |
| ) else ( | |
| echo NVIDIA driver and CUDA runtime info: | |
| nvidia-smi --query-gpu=name,driver_version,cuda_version --format=csv,noheader 2>nul | |
| if errorlevel 1 ( | |
| echo NOTE: nvidia-smi is present but query failed. Trying nvidia-smi -L | |
| nvidia-smi -L 2>nul | |
| ) | |
| ) | |
| echo. | |
| echo Checking for CUDA Toolkit (nvcc)... | |
| if defined CUDA_PATH ( | |
| if exist "%CUDA_PATH%\bin\nvcc.exe" ( | |
| echo Found nvcc at: %CUDA_PATH%\bin\nvcc.exe | |
| "%CUDA_PATH%\bin\nvcc.exe" --version 2>nul | |
| ) else ( | |
| echo CUDA_PATH is set but nvcc not found under: %CUDA_PATH%\bin | |
| ) | |
| ) else ( | |
| where nvcc >nul 2>nul | |
| if errorlevel 1 ( | |
| echo NOTE: nvcc not found (CUDA Toolkit not detected). This is usually OK for most users. | |
| ) else ( | |
| echo Found nvcc on PATH: | |
| nvcc --version 2>nul | |
| ) | |
| ) | |
| REM --- Winget / App Installer --- | |
| set "FAILED=0" | |
| echo. | |
| echo [Ensuring App Installer is updated] | |
| call :EnsurePowerShell | |
| if errorlevel 1 ( | |
| echo ERROR: PowerShell not found; cannot update App Installer. | |
| echo Install/repair App Installer manually from: https://aka.ms/getwinget | |
| exit /b 1 | |
| ) | |
| call :UpdateAppInstaller | |
| if errorlevel 1 ( | |
| echo WARNING: App Installer update step failed. | |
| echo You can install/repair it manually from: https://aka.ms/getwinget | |
| ) | |
| echo. | |
| echo [Checking winget] | |
| where winget >nul 2>nul | |
| if errorlevel 1 ( | |
| echo ERROR: winget not found. | |
| echo Install/repair App Installer from: https://aka.ms/getwinget | |
| exit /b 1 | |
| ) | |
| winget --version | |
| if errorlevel 1 ( | |
| echo ERROR: winget exists but failed to run. | |
| echo Try reinstalling App Installer from: https://aka.ms/getwinget | |
| exit /b 1 | |
| ) | |
| echo. | |
| echo [Installing packages] | |
| echo Installing qBittorrent.qBittorrent (source: winget)... | |
| winget install --id qBittorrent.qBittorrent -e --source winget --accept-source-agreements --accept-package-agreements | |
| if errorlevel 1 ( | |
| set "FAILED=1" | |
| echo ERROR: qBittorrent install failed. | |
| ) | |
| echo. | |
| echo Opening magnet link (placeholder)... | |
| powershell -NoProfile -ExecutionPolicy Bypass -Command "try { if($env:MAGNET_LINK){ Start-Process -FilePath $env:MAGNET_LINK } else { Write-Host 'MAGNET_LINK is not set; skipping.' } } catch { exit 1 }" >nul | |
| echo. | |
| echo Installing Git.Git (source: winget)... | |
| winget install --id Git.Git -e --source winget --accept-source-agreements --accept-package-agreements | |
| if errorlevel 1 ( | |
| set "FAILED=1" | |
| echo ERROR: Git install failed. | |
| ) | |
| echo. | |
| echo Installing Comfy.ComfyUI-Desktop (source: winget)... | |
| winget install --id Comfy.ComfyUI-Desktop -e --source winget --accept-source-agreements --accept-package-agreements | |
| if errorlevel 1 ( | |
| set "FAILED=1" | |
| echo ERROR: ComfyUI Desktop install failed. | |
| ) | |
| echo. | |
| echo ============================================================ | |
| if "%FAILED%"=="0" ( | |
| echo Done. | |
| exit /b 0 | |
| ) else ( | |
| echo Done, but one or more steps failed. | |
| echo Tip: re-run this script in an elevated terminal if needed. | |
| exit /b 2 | |
| ) | |
| REM ============================================================ | |
| REM Helpers | |
| REM ============================================================ | |
| :EnsurePowerShell | |
| where powershell >nul 2>nul | |
| if errorlevel 1 exit /b 1 | |
| exit /b 0 | |
| :UpdateAppInstaller | |
| REM Downloads and installs/repairs App Installer (winget) from https://aka.ms/getwinget | |
| setlocal | |
| set "URL=https://aka.ms/getwinget" | |
| set "OUT=%TEMP%\AppInstaller.msixbundle" | |
| powershell -NoProfile -ExecutionPolicy Bypass -Command "$ErrorActionPreference='Stop'; try { [Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12 } catch {} ; $ProgressPreference='SilentlyContinue'; Invoke-WebRequest -Uri '%URL%' -OutFile '%OUT%'; Add-AppxPackage -Path '%OUT%'" >nul | |
| if errorlevel 1 ( | |
| endlocal & exit /b 1 | |
| ) | |
| endlocal & exit /b 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment