@echo off&title Office 2016/2013/2010 VL KMS激活工具
:: =============最多可以设置 50 个KMS服务器===========
set KMS3=kms.03k.org
set KMS4=kms.chinancce.com
set KMS5=kms.digiboy.ir
set KMS6=kms.lotro.cc
set KMS7=kms-win.msdn123.com
set KMS8=m.zpale.com
set KMS9=mvg.zpale.com
set KMS10=www.beishe.cc
set KMS11=xykz.f3322.org
set KMS12=www.zgbs.cc
set KMS13=kms.dwhd.org
set KMS14=kms.imazes.org
set KMS15=122.226.152.230
set KMS16=115.159.2.184
set KMS17=119.28.13.193
set KMS18=3rss.vicp.net:20439
set KMS19=54.223.212.31
set KMS20=cy2617.6655.la
set KMS21=kms.aliyun-inc.com
set KMS22=kms.shuax.com
set KMS23=ss.yechiu.xin
:: ===================================================

setlocal EnableDelayedExpansion
cd /d "%CD%\Office16"
for /L %%a in (1,1,50) do (
  if defined KMS%%a (
    echo 正在尝试KMS激活: !KMS%%a!
    cscript //Nologo ospp.vbs /sethst:!KMS%%a! >nul
    (cscript //nologo ospp.vbs /act) ^| find /i "successful" && (echo=&echo 激活成功！服务器为: !KMS%%a!&goto :EOF)))
echo=
echo 激活失败！请确认Office是VL版或更新KMS列表
pause
goto :EOF