@echo off setlocal rem Agrega el gateway y conserva los que ya tengas (con copia de seguridad). rem gw.nynusoft.com powershell -NoProfile -ExecutionPolicy Bypass -Command "$ErrorActionPreference='Stop';$path='Software\Battle.net\Configuration';$name='Battle.net Gateways';$a='gw.nynusoft.com';$z='0';$t='gw.nynusoft.com';$b=Join-Path $env:USERPROFILE ('battle.net-gateways-' + (Get-Date -f yyyyMMdd-HHmmss) + '.reg');reg export 'HKCU\Software\Battle.net\Configuration' $b /y 2>&1 | Out-Null;try {$k=[Microsoft.Win32.Registry]::CurrentUser.CreateSubKey($path);$cur=$k.GetValue($name);if ($cur -is [string]) { Write-Host 'El valor Battle.net Gateways no es una lista: usa gateway.reg o regedit.'; exit 1 };if (-not $cur) { $cur=@() };$s=@($cur);if ($s.Count -gt 2 -and $s[0] -eq '1001') { $s=$s[2..($s.Count-1)] };$g=@();for ($i=0; $i -lt $s.Count-2; $i+=3) { $g+=,@($s[$i],$s[$i+1],$s[$i+2]) };$g=@($g | Where-Object { $_[0] -ne $a });$g+=,@($a,$z,$t);$f=@('1001',('{0:d2}' -f $g.Count));foreach ($x in $g) { $f+=$x };$k.SetValue($name,[string[]]$f,[Microsoft.Win32.RegistryValueKind]::MultiString);if (@($k.GetValue($name)).Count -ne $f.Count) { Write-Host 'Revisa el valor con regedit.'; exit 1 };$k.Close();Write-Host ('Gateway agregado: ' + $a + ' | Copia de seguridad en: ' + $b);exit 0} catch {Write-Host ('Error: ' + $_.Exception.Message); exit 1}" if errorlevel 1 (echo Hubo un problema: mira el mensaje de arriba.) echo. pause