@echo off&setlocal EnableDelayedExpansion&color 5e
title KMS_Activation for Windows ALL - (Comlan)
:WH
cls
echo.
echo Select the version of Windows that needs to be activated----COMLAN
echo.
echo --------------------------------------------------------------------------------
echo 1. Windows 10 ALL
echo.
echo 2. Windows 8.1 ALL
echo.
echo 3. Windows 8 ALL
echo.
echo 4. Windows 7 ALL
echo.
echo 5. Windows Server 2012 ALL
echo.
echo 6. Windows Server 2012 R2 ALL
echo.
echo 7. Windows Server 2016 ALL
echo.
echo 8. Windows Server 2008 R2 ALL
echo.
echo 9. Windows Server 2019 ALL
echo.
echo 10. Office 2016 ALL
echo.
echo 11. Office 2013 ALL
echo.
echo 12. Office 2010 ALL
echo.
echo 13. Office 2019 ALL
echo. --------------------------------------------------------------------------------
set /p tsk="Please enter the version number of the Windows you want to activate (Enter) Confirm(1-8): "
if not defined tsk goto:err
if %tsk%==1 goto:1
if %tsk%==2 goto:2
if %tsk%==3 goto:3
if %tsk%==4 goto:4
if %tsk%==5 goto:5
if %tsk%==6 goto:6
if %tsk%==7 goto:7
if %tsk%==8 goto:8
if %tsk%==9 goto:9
if %tsk%==10 goto:10
if %tsk%==11 goto:11
if %tsk%==12 goto:12
if %tsk%==13 goto:13
:err
goto:WH
:1
cls
set KMS_Sev=kms.comlan.com
::======================= The following content does not need to change ======================
call :verchk
call :adminchk
set Core=TX9XD-98N7V-6WMQ6-BX7FG-H8Q99
set CoreCountrySpecific=PVMJN-6DFY6-9CCP6-7BKTT-D3WVR
set CoreN=3KHY7-WNT83-DGQKR-F7HPR-844BM
set CoreSingleLanguage=7HNRX-D7KGG-3K4RQ-4WPJ4-YTDFH
set Professional=W269N-WFGWX-YVC9B-4J6C9-T83GX
set ProfessionalN=MH37W-N47XK-V7XM9-C7227-GCQG9
set Enterprise=NPPR9-FWDCX-D2C8J-H872K-2YT43
set EnterpriseN=DPH2V-TTNVB-4X9Q3-TJR4H-KHJW4
set Education=NW6C2-QMPVW-D7KKK-3GKT6-VCFB2
set EducationN=2WH4N-8QGBV-H22JP-CT43Q-MDWWJ
set EnterpriseS=WNMTR-4C88C-JK8YV-HQ7T2-76DF9
set EnterpriseSN=2F77B-TNFGY-69QQF-B8YKP-D69TJ
for /f "tokens=3 delims= " %%i in ('reg QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "EditionID"') do set EditionID=%%i
if defined %EditionID% (
cscript //Nologo %windir%\system32\slmgr.vbs /ipk !%EditionID%!
cscript //Nologo %windir%\system32\slmgr.vbs /skms %KMS_Sev%
cscript //Nologo %windir%\system32\slmgr.vbs /ato
) else (
echo.&echo Not found DEFINED Key: "%EditionID%".
echo.
)
pause
exit
:verchk
ver | find "10.0." >nul 2>nul && (goto :EOF)
echo.&echo The current OS is NOT Windows 10.
echo.&pause
exit
:adminchk
reg query "HKU\S-1-5-19" >nul 2>nul || (
cls&echo.&echo Run as ADMINISTRATOR, Pls.
echo.&echo Press any key to exit.
echo.&pause>nul
exit)
goto :EOF
:2
cls
set KMS_Sev=kms.comlan.com
::======================= The following content does not need to change ======================
call :adminchk
set Professional=FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4
set ProfessionalN=MRPKT-YTG23-K7D7T-X2JMM-QY7MG
set ProfessionalE=W82YF-2Q76Y-63HXB-FGJG9-GF7QX
set Enterprise=33PXH-7Y6KF-2VJC9-XBBR8-HVTHH
set EnterpriseN=YDRBP-3D83W-TY26F-D46B2-XCKRJ
set EnterpriseE=C29WB-22CC8-VJ326-GHFJW-H9DH4J
for /f "tokens=3 delims= " %%i in ('reg QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "EditionID"') do set EditionID=%%i
if defined %EditionID% (
cscript //Nologo %windir%\system32\slmgr.vbs /ipk !%EditionID%!
cscript //Nologo %windir%\system32\slmgr.vbs /skms %KMS_Sev%
cscript //Nologo %windir%\system32\slmgr.vbs /ato
) else (
echo.&echo Not found DEFINED Key: "%EditionID%".
echo.
)
pause
exit
:adminchk
reg query "HKU\S-1-5-19" >nul 2>nul || (
cls&echo.&echo Run as ADMINISTRATOR, Pls.
echo.&echo Press any key to exit.
echo.&pause>nul
exit)
goto :EOF
:3
cls
set KMS_Sev=kms.comlan.com
::======================= The following content does not need to change ======================
call :verchk
call :adminchk
set Professional=GCRJD-8NW9H-F2CDX-CCM8D-9D6T9
set ProfessionalN=HMCNV-VVBFX-7HMBH-CTY9B-B4FXY
set Enterprise=MHF9N-XY6XB-WVXMC-BTDCT-MKKG7
set EnterpriseN=TT4HM-HN7YT-62K67-RGRQJ-JFFXW
for /f "tokens=3 delims= " %%i in ('reg QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "EditionID"') do set EditionID=%%i
if defined %EditionID% (
cscript //Nologo %windir%\system32\slmgr.vbs /ipk !%EditionID%!
cscript //Nologo %windir%\system32\slmgr.vbs /skms %KMS_Sev%
cscript //Nologo %windir%\system32\slmgr.vbs /ato
) else (
echo.&echo Not found DEFINED Key: "%EditionID%".
echo.
)
pause
exit
:verchk
ver | find "8.1." >nul 2>nul && (goto :EOF)
echo.&echo The current OS is NOT Windows 8.
echo.&pause
exit
:adminchk
reg query "HKU\S-1-5-19" >nul 2>nul || (
cls&echo.&echo Run as ADMINISTRATOR, Pls.
echo.&echo Press any key to exit.
echo.&pause>nul
exit)
goto :EOF
:4
cls
set KMS_Sev=kms.comlan.com
::======================= The following content does not need to change ======================
call :verchk
call :adminchk
set Professional=NG4HW-VH26C-733KW-K6F98-J8CK4
set ProfessionalN=XCVCF-2NXM9-723PB-MHCB7-2RYQQ
set Enterprise=32JNW-9KQ84-P47T8-D8GGY-CWCK7
set EnterpriseN=JMNMF-RHW7P-DMY6X-RF3DR-X2BQT
for /f "tokens=3 delims= " %%i in ('reg QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "EditionID"') do set EditionID=%%i
if defined %EditionID% (
cscript //Nologo %windir%\system32\slmgr.vbs /ipk !%EditionID%!
cscript //Nologo %windir%\system32\slmgr.vbs /skms %KMS_Sev%
cscript //Nologo %windir%\system32\slmgr.vbs /ato
) else (
echo.&echo Not found DEFINED Key: "%EditionID%".
echo.
)
pause
exit
:verchk
ver | find "8.0." >nul 2>nul && (goto :EOF)
echo.&echo The current OS is NOT Windows 8.
echo.&pause
exit
:adminchk
reg query "HKU\S-1-5-19" >nul 2>nul || (
cls&echo.&echo Run as ADMINISTRATOR, Pls.
echo.&echo Press any key to exit.
echo.&pause>nul
exit)
goto :EOF
:5
cls
set KMS_Sev=kms.comlan.com
::======================= The following content does not need to change ======================
call :verchk
call :adminchk
set ServerDatacenter=48HP8-DN98B-MYWDG-T2DCC-8W83P
set ServerStandard=XC9B7-NBPP2-83J2H-RHMBY-92BT4
for /f "tokens=3 delims= " %%i in ('reg QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "EditionID"') do set EditionID=%%i
if defined %EditionID% (
cscript //Nologo %windir%\system32\slmgr.vbs /ipk !%EditionID%!
cscript //Nologo %windir%\system32\slmgr.vbs /skms %KMS_Sev%
cscript //Nologo %windir%\system32\slmgr.vbs /ato
) else (
echo.&echo Not found DEFINED Key: "%EditionID%".
echo.
)
pause
exit
:verchk
ver | find "10.0." >nul 2>nul && (goto :EOF)
echo.&echo The current OS is NOT Windows 10.
echo.&pause
exit
:adminchk
reg query "HKU\S-1-5-19" >nul 2>nul || (
cls&echo.&echo Run as ADMINISTRATOR, Pls.
echo.&echo Press any key to exit.
echo.&pause>nul
exit)
goto :EOF
:6
cls
set KMS_Sev=kms.comlan.com
::======================= The following content does not need to change ======================
call :verchk
call :adminchk
set ServerDatacenter=W3GGN-FT8W3-Y4M27-J84CP-Q3VJ9
set ServerStandard=D2N9P-3P6X9-2R39C-7RTCD-MDVJX
set ServerEnterprise=KNC87-3J2TX-XB4WP-VCPJV-M4FWM
for /f "tokens=3 delims= " %%i in ('reg QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "EditionID"') do set EditionID=%%i
if defined %EditionID% (
cscript //Nologo %windir%\system32\slmgr.vbs /ipk !%EditionID%!
cscript //Nologo %windir%\system32\slmgr.vbs /skms %KMS_Sev%
cscript //Nologo %windir%\system32\slmgr.vbs /ato
) else (
echo.&echo Not found DEFINED Key: "%EditionID%".
echo.
)
pause
exit
:verchk
ver | find "10.0." >nul 2>nul && (goto :EOF)
echo.&echo The current OS is NOT Windows 10.
echo.&pause
exit
:adminchk
reg query "HKU\S-1-5-19" >nul 2>nul || (
cls&echo.&echo Run as ADMINISTRATOR, Pls.
echo.&echo Press any key to exit.
echo.&pause>nul
exit)
goto :EOF
:7
cls
set KMS_Sev=kms.comlan.com
::======================= The following content does not need to change ======================
call :verchk
call :adminchk
set ServerDatacenter=CB7KF-BWN84-R7R2Y-793K2-8XDDG
set ServerStandard=WC2BQ-8NRM3-FDDYY-2BFGV-KHKQY
set ServerEnterprise=JCKRF-N37P4-C2D82-9YXRT-4M63B
for /f "tokens=3 delims= " %%i in ('reg QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "EditionID"') do set EditionID=%%i
if defined %EditionID% (
cscript //Nologo %windir%\system32\slmgr.vbs /ipk !%EditionID%!
cscript //Nologo %windir%\system32\slmgr.vbs /skms %KMS_Sev%
cscript //Nologo %windir%\system32\slmgr.vbs /ato
) else (
echo.&echo Not found DEFINED Key: "%EditionID%".
echo.
)
pause
exit
:verchk
ver | find "10.0." >nul 2>nul && (goto :EOF)
echo.&echo The current OS is NOT Windows 10.
echo.&pause
exit
:adminchk
reg query "HKU\S-1-5-19" >nul 2>nul || (
cls&echo.&echo Run as ADMINISTRATOR, Pls.
echo.&echo Press any key to exit.
echo.&pause>nul
exit)
goto :EOF
:8
cls
set KMS_Sev=kms.comlan.com
::======================= The following content does not need to change ======================
call :verchk
call :adminchk
set ServerDatacenter=74YFP-3QFB3-KQT8W-PMXWJ-7M648
set ServerStandard=YC6KT-GKW9T-YTKYR-T4X34-R7VHC
set ServerEnterprise=489J6-VHDMP-X63PK-3K798-CPX3Y
for /f "tokens=3 delims= " %%i in ('reg QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "EditionID"') do set EditionID=%%i
if defined %EditionID% (
cscript //Nologo %windir%\system32\slmgr.vbs /ipk !%EditionID%!
cscript //Nologo %windir%\system32\slmgr.vbs /skms %KMS_Sev%
cscript //Nologo %windir%\system32\slmgr.vbs /ato
) else (
echo.&echo Not found DEFINED Key: "%EditionID%".
echo.
)
pause
exit
:verchk
ver | find "10.0." >nul 2>nul && (goto :EOF)
echo.&echo The current OS is NOT Windows 10.
echo.&pause
exit
:adminchk
reg query "HKU\S-1-5-19" >nul 2>nul || (
cls&echo.&echo Run as ADMINISTRATOR, Pls.
echo.&echo Press any key to exit.
echo.&pause>nul
exit)
goto :EOF
:9
cls
set KMS_Sev=kms.comlan.com
::======================= The following content does not need to change ======================
call :verchk
call :adminchk
set ServerDatacenter=WMDGN-G9PQG-XVVXX-R3X43-63DFG
set ServerStandard=N69G4-B89J2-4G8F4-WWYCC-J464C
set ServerEnterprise=WVDHN-86M7X-466P6-VHXV7-YY726
for /f "tokens=3 delims= " %%i in ('reg QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "EditionID"') do set EditionID=%%i
if defined %EditionID% (
cscript //Nologo %windir%\system32\slmgr.vbs /ipk !%EditionID%!
cscript //Nologo %windir%\system32\slmgr.vbs /skms %KMS_Sev%
cscript //Nologo %windir%\system32\slmgr.vbs /ato
) else (
echo.&echo Not found DEFINED Key: "%EditionID%".
echo.
)
pause
exit
:verchk
ver | find "10.0." >nul 2>nul && (goto :EOF)
echo.&echo The current OS is NOT Windows 10.
echo.&pause
exit
:adminchk
reg query "HKU\S-1-5-19" >nul 2>nul || (
cls&echo.&echo Run as ADMINISTRATOR, Pls.
echo.&echo Press any key to exit.
echo.&pause>nul
exit)
goto :EOF
:10
cls
set BatPath=%~dp0
set BatPath=%BatPath:~0,-1%
for /f "tokens=6 delims=[]. " %%G in ('ver') do set win=%%G
rem Judging 32/64 bit
set "ospp=%ProgramFiles%\Microsoft Office\Office16\ospp.vbs"
if not exist "%ospp%" (
set "ospp=%ProgramFiles(x86)%\Microsoft Office\Office16\ospp.vbs"
)
:Setting variables===============================
set ip=kms.comlan.com
:Start the KMS server==========================
:kms.comlan.com
if %errorlevel% EQU 0 (
echo Connect the KMS server:%ip% success!
echo.
) else ( goto :kms.comlan.com )
:Start activation===============================
ECHO.Office Is activating……
::Uninstall the installed product key. The following number is the last 5 digits of the key.
::cscript ospp.vbs /unpkey:xxxxx
::Office Professional Plus Key
::Visio Professional Key
::Project Professional Key
cscript "%ospp%" /inpkey:XQNVK-8JYDB-WJ9W3-YJ8YR-WFG99 >nul
cscript "%ospp%" /inpkey:PD3PC-RHNGV-FXJ29-8JK7D-RJRJK >nul
cscript "%ospp%" /inpkey:YG9NW-3K39V-2T3HJ-93F3Q-G83KT >nul
cscript "%ospp%" /inpkey:JNRGM-WHDWX-FJJG3-K47QV-DRTFM >nul
cscript "%ospp%" /inpkey:7WHWN-4T7MP-G96JF-G33KR-W8GF4 >nul
cscript "%ospp%" /inpkey:GNFHQ-F6YQM-KQDGJ-327XX-KQBVC >nul
cscript "%ospp%" /sethst:%ip% >nul
cscript "%ospp%" /act
pause
:dstatus
cls
echo Office Active state……
cscript "%ospp%" /dstatus
pause
goto :EFO
:11
cls
set BatPath=%~dp0
set BatPath=%BatPath:~0,-1%
for /f "tokens=6 delims=[]. " %%G in ('ver') do set win=%%G
rem Judging 32/64 bit
set "ospp=%ProgramFiles%\Microsoft Office\Office15\ospp.vbs"
if not exist "%ospp%" (
set "ospp=%ProgramFiles(x86)%\Microsoft Office\Office15\ospp.vbs"
)
:Setting variables===============================
set ip=kms.comlan.com
:Start the KMS server==========================
:kms.comlan.com
if %errorlevel% EQU 0 (
echo Connect the KMS server:%ip% success!
echo.
) else ( goto :kms.comlan.com )
:Start activation===============================
ECHO.Office Is activating……
::Uninstall the installed product key. The following number is the last 5 digits of the key.
::cscript ospp.vbs /unpkey:xxxxx
::Office Professional Plus Key
::Visio Professional Key
::Project Professional Key
cscript "%ospp%" /inpkey:YC7DK-G2NP3-2QQC3-J6H88-GVGXT >nul
cscript "%ospp%" /inpkey:C2FG9-N6J68-H8BTJ-BW3QX-RM3B3 >nul
cscript "%ospp%" /inpkey:FN8TT-7WMH6-2D4X9-M337T-2342K >nul
cscript "%ospp%" /inpkey:KBKQT-2NMXY-JJWGP-M62JB-92CD4 >nul
cscript "%ospp%" /inpkey:J484Y-4NKBF-W2HMG-DBMJC-PGWR7 >nul
cscript "%ospp%" /inpkey:6NTH3-CW976-3G3Y2-JK3TX-8QHTT >nul
cscript "%ospp%" /sethst:%ip% >nul
cscript "%ospp%" /act
pause
:dstatus
cls
echo Office Active state……
cscript "%ospp%" /dstatus
pause
goto :EFO
:12
cls
set BatPath=%~dp0
set BatPath=%BatPath:~0,-1%
for /f "tokens=6 delims=[]. " %%G in ('ver') do set win=%%G
rem Judging 32/64 bit
set "ospp=%ProgramFiles%\Microsoft Office\Office15\ospp.vbs"
if not exist "%ospp%" (
set "ospp=%ProgramFiles(x86)%\Microsoft Office\Office15\ospp.vbs"
)
:Setting variables===============================
set ip=kms.comlan.com
:Start the KMS server==========================
:kms.comlan.com
if %errorlevel% EQU 0 (
echo Connect the KMS server:%ip% success!
echo.
) else ( goto :kms.comlan.com )
:Start activation===============================
ECHO.Office Is activating……
::Uninstall the installed product key. The following number is the last 5 digits of the key.
::cscript ospp.vbs /unpkey:xxxxx
::Office Professional Plus Key
::Office 2013 Standard Key
::Visio Professional Key
::Project Professional Key
cscript "%ospp%" /inpkey:VYBBJ-TRJPB-QFQRF-QFT4D-H3GVB >nul
cscript "%ospp%" /inpkey:7MCW8-VRQVK-G677T-PDJCM-Q8TCP >nul
cscript "%ospp%" /inpkey:YGX6F-PGV49-PGW3J-9BTGG-VHKC6 >nul
cscript "%ospp%" /inpkey:V7QKV-4XVVR-XYV4D-F7DFM-8R6BM >nul
cscript "%ospp%" /inpkey:767HD-QGMWX-8QTDB-9G3R2-KHFGJ >nul
cscript "%ospp%" /inpkey:4HP3K-88W3F-W2K3D-6677X-F9PGB >nul
cscript "%ospp%" /sethst:%ip% >nul
cscript "%ospp%" /act
pause
:dstatus
cls
echo Office Active state……
cscript "%ospp%" /dstatus
pause
goto :EFO
:13
cls
set BatPath=%~dp0
set BatPath=%BatPath:~0,-1%
for /f "tokens=6 delims=[]. " %%G in ('ver') do set win=%%G
rem Judging 32/64 bit
set "ospp=%ProgramFiles%\Microsoft Office\Office16\ospp.vbs"
if not exist "%ospp%" (
set "ospp=%ProgramFiles(x86)%\Microsoft Office\Office16\ospp.vbs"
)
:Setting variables===============================
set ip=kms.comlan.com
:Start the KMS server==========================
:kms.comlan.com
if %errorlevel% EQU 0 (
echo Connect the KMS server:%ip% success!
echo.
) else ( goto :kms.comlan.com )
:Start activation===============================
ECHO.Office Is activating……
::Uninstall the installed product key. The following number is the last 5 digits of the key.
::cscript ospp.vbs /unpkey:xxxxx
::Office Professional Plus Key
::Visio Professional Key
::Project Professional Key
cscript "%ospp%" /inpkey:NMMKJ-6RK4F-KMJVX-8D9MJ-6MWKP >nul
cscript "%ospp%" /inpkey:9BGNQ-K37YR-RQHF2-38RQ3-7VCBB >nul
cscript "%ospp%" /inpkey:B4NPR-3FKK7-T2MBV-FRQ4W-PKD2B >nul
cscript "%ospp%" /inpkey:6NWWJ-YQWMR-QKGCB-6TMB3-9D9HK >nul
cscript "%ospp%" /inpkey:7TQNQ-K3YQQ-3PFH7-CCPPM-X4VQ2 >nul
cscript "%ospp%" /inpkey:C4F7P-NCP8C-6CQPT-MQHV9-JXD2M >nul
cscript "%ospp%" /sethst:%ip% >nul
cscript "%ospp%" /act
pause
:dstatus
cls
echo Office Active state……
cscript "%ospp%" /dstatus
pause
goto :EFO
:EOF
echo.
echo Activation was successful. Please press any key to exit!
pause >nul
exit
来源:51CTO
作者:海斌2019
链接:https://blog.51cto.com/10981246/2470368