# Installs Desktop, Start Menu, and Windows Startup shortcuts that start THIS # clone's Comfy host agent (YuE2) and replace any stale process on 8199. $ErrorActionPreference = 'Stop' $root = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path $vbs = Join-Path $root 'scripts\launch-comfy-host-agent.vbs' $startPs1 = Join-Path $root 'scripts\start-comfy-host-agent.ps1' if (-not (Test-Path $vbs)) { throw "Missing $vbs" } if (-not (Test-Path $startPs1)) { throw "Missing $startPs1" } $shell = New-Object -ComObject WScript.Shell $desktop = [Environment]::GetFolderPath('Desktop') $programs = Join-Path ([Environment]::GetFolderPath('StartMenu')) 'Programs\AIGen' $startup = [Environment]::GetFolderPath('Startup') New-Item -ItemType Directory -Force -Path $programs | Out-Null function Save-Shortcut([string]$dir, [string]$name = 'Start Comfy Host Agent.lnk') { $path = Join-Path $dir $name $lnk = $shell.CreateShortcut($path) $lnk.TargetPath = (Join-Path $env:SystemRoot 'System32\wscript.exe') $lnk.Arguments = "//B `"$vbs`"" $lnk.WorkingDirectory = $root $lnk.WindowStyle = 7 $lnk.Description = 'Start THIS AIGen Comfy host agent (YuE2) and replace any stale agent on 8199' $lnk.Save() $path } $saved = @( (Save-Shortcut $desktop), (Save-Shortcut $programs), (Save-Shortcut $startup 'AIGen Comfy Host Agent.lnk') ) # Point the scheduled task at this clone when it already exists. $taskName = 'AIGen Comfy Host Agent' $existing = schtasks /Query /TN $taskName 2>$null if ($LASTEXITCODE -eq 0) { $hidden = Join-Path $root 'scripts\start-comfy-host-agent-hidden.vbs' $tr = "wscript.exe //B `"$hidden`"" schtasks /Change /TN $taskName /TR $tr | Out-Null Write-Host "Updated scheduled task '$taskName' -> $hidden" } Write-Host "Installed launchers for $root" $saved | ForEach-Object { Write-Host " $_" } Write-Host '' Write-Host 'One click: double-click Desktop "Start Comfy Host Agent", or log off/on so Startup runs it.' Write-Host 'That replaces any old node on 8199 with this clone (YuE2 /yue2/status).'