@echo off setlocal rem Adds the gw.nynusoft.com gateway to StarCraft / Brood War. rem Keeps the gateways you already have and saves a backup first. rem Served by gw.nynusoft.com. powershell -NoProfile -ExecutionPolicy Bypass -Command "$ErrorActionPreference='Stop';$k='HKCU\Software\Battle.net\Configuration';$n='Battle.net Gateways';$a='gw.nynusoft.com';$z='0';$t='gw.nynusoft.com';New-Item -Path $k -Force | Out-Null;$b=Join-Path $env:USERPROFILE ('battle.net-gateways-' + (Get-Date -f yyyyMMdd-HHmmss) + '.reg');reg export 'HKCU\Software\Battle.net\Configuration' $b /y | Out-Null;$c=(Get-ItemProperty -Path $k -Name $n -ErrorAction SilentlyContinue).$n;if (-not $c) { $c=@('uswest.battle.net','8','U.S. West','useast.battle.net','6','U.S. East','asia.battle.net','-9','Asia','europe.battle.net','-1','Europe') };$s=@($c);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 };Set-ItemProperty -Path $k -Name $n -Value $f -Type MultiString;Write-Host ('Gateway ' + $a + ' added. Backup: ' + $b)" if errorlevel 1 (echo Something went wrong. Run it again and read the message above.) echo. pause