windows office 全能激活器 win10tools151217.bat

之前更新了几版,但都没有及时放上来。目前可以称之为全能激活器了,可以激活的操作系统从vista到win10,server2008到server2016,从office2010到office2016。
新增的功能:
可以选择现有的kms服务器(收集中),也可以手动输入自己的kms服务器。
名称从win8tools改为win10tools。
增加win10各版本密钥和office 2016 pro plus 密钥。
目前已知的问题:
自动激活功能中激活windows和office第一次尝试后会中断后续执行。
office2010密钥缺失中,目前用2013的替代。
enjoy it!

下载链接: http://pan.baidu.com/s/1mgS5pBq 密码: 17yg

下面是脚本源代码,保存为*.bat文件右键管理员运行。

@echo off
rem 设置KMSServer0变量不为空将强行使用该变量,否则激活时需要手动输入或选择。
set KMSServer0=
set KMSServer1=58.173.212.51
set KMSServer2=mvg.zpale.com
set KMSServer3=zh.us.to
set KMSServer4=franklv.ddns.net
set KMSServer5=kms.xspace.in
set KMSServer6=110.noip.me
set LogFileName=win10tools.error.log
set win10toolsver=2015.12.17

setlocal enabledelayedexpansion

rem 权限检测
echo admintest> %Windir%\System32\admintestfile.txt
if ERRORLEVEL 1 (
echo 请在这个脚本文件上单机鼠标右键,选择“以管理员身份运行”。
pause
exit
)
if exist %Windir%\System32\admintestfile.txt del %Windir%\System32\admintestfile.txt>nul 2>nul
goto main

:main
cls
title Win10 Tools %win10toolsver%
echo ------ Win10 Tools %win10toolsver% ------
echo 说明:
echo     1.请右键以管理员身份运行,如果没有请关闭本窗口重新运行
echo     2.执行完毕之后会有提示,请耐心等待
echo     3.设置KMSServer变量不为空将强行使用该变量,否则激活时需要手动输入或选择。
echo     4.无法激活、工具BUG等反馈交流QQ群:48293344、48221012
echo     5.MSDN原版系统下载:codeclip.com/msdn                       xy %win10toolsver%
echo.
echo ------ 功能选择 ------
echo.
echo     1 自动激活 Windows 和 Office
echo     2 手动激活 Windows 和 Office
echo     3 小工具箱
echo     4 检测 Windows 版本
echo  list 查看可激活系统列表

echo.
set /p choice="请输入对应功能前面的字符串并敲回车:"
if %choice%==1 call :autoat & echo. & echo 按任意键返回... & pause >nul & cls & goto :main
if %choice%==2 call :manualat & echo. & echo 按任意键返回... & pause >nul & cls & goto :main
if %choice%==3 call :tools & echo. & echo 按任意键返回... & pause >nul & cls & goto :main
if %choice%==4 call :checkver & echo. & echo 按任意键返回... & pause >nul & cls & goto :main
if %choice%==list call :list & echo. & echo 按任意键返回... & pause >nul & cls & goto :main
goto :main


:manualat
cls
title KMS 激活
echo ------ KMS 激活 ------
echo 说明:
echo     1.这里只列出了最新的常用系统,其它系统请使用自动激活选项
echo     2.要确定你的系统是否受支持,请查看可激活系统列表
echo.
echo ------ 软件选择 ------
echo.
echo     1 Windows 8.1 Professional
echo     2 Windows 8.1 Enterprise
echo     3 Windows Server 2012 R2 Standard
echo     4 Windows Server 2012 R2 Datacenter
echo     5 Windows 8 Professional
echo     6 Windows 8 Enterprise
echo     7 Windows Server 2012 Standard
echo     8 Windows Server 2012 Datacenter
echo     9 Windows 10 Professional
echo    10 Windows 10 Enterprise
echo  2010 Office 2010 VL (Office14)
echo  2013 Office 2013 VL (Office15)
echo  2016 Office 2016 VL (Office16)
echo  list 查看可激活系统列表
echo     0 返回

echo.
set /p choice="请输入对应版本前面的字符串并敲回车:"
if %choice%==1 call :Windows8.1Pro & echo. & echo 按任意键返回... & pause >nul & cls & goto :manualat
if %choice%==2 call :Windows8.1Enterprise & echo. & echo 按任意键返回... & pause >nul & cls & goto :manualat
if %choice%==3 call :WindowsServer2012R2Standard & echo. & echo 按任意键返回... & pause >nul & cls & goto :manualat
if %choice%==4 call :WindowsServer2012R2Datacenter & echo. & echo 按任意键返回... & pause >nul & cls & goto :manualat
if %choice%==5 call :Windows8Pro & echo. & echo 按任意键返回... & pause >nul & cls & goto :manualat
if %choice%==6 call :Windows8Enterprise & echo. & echo 按任意键返回... & pause >nul & cls & goto :manualat
if %choice%==7 call :WindowsServer2012Standard & echo. & echo 按任意键返回... & pause >nul & cls & goto :manualat
if %choice%==8 call :WindowsServer2012Datacenter & echo. & echo 按任意键返回... & pause >nul & cls & goto :manualat
if %choice%==9 call :Windows10Pro & echo. & echo 按任意键返回... & pause >nul & cls & goto :manualat
if %choice%==10 call :Windows10Enterprise & echo. & echo 按任意键返回... & pause >nul & cls & goto :manualat
if %choice%==2010 call :Office14 & echo. & echo 按任意键返回... & pause >nul & cls & goto :manualat
if %choice%==2013 call :Office15 & echo. & echo 按任意键返回... & pause >nul & cls & goto :manualat
if %choice%==2016 call :Office16 & echo. & echo 按任意键返回... & pause >nul & cls & goto :manualat
if %choice%==list call :list & echo. & echo 按任意键返回... & pause >nul & cls & goto :manualat
if %choice%==0 goto :main
goto :manualat

:tools
cls
title Tools
echo ------ Tools ------
echo 说明:
echo     1.这里的工具大部分兼容64位系统,32位没做测试,欢迎加群交流
echo.
echo ------ 工具选择 ------
echo.
echo     1 修改远程端口并启用远程连接
echo     2 修改远程端口并启用远程连接(WS2003)
echo     3 设定开机自动登陆并锁定系统
echo     4 关闭服务使系统更安全
echo     5 获取网卡MAC地址
echo     6 磁盘清理 - 清理冗余更新(WinSxS冗余)
echo     7 开启任务管理性能选项卡里的磁盘性能监视器
echo     8 开启桌面体验(Desktop Experience)
echo     9 开启无线网络连接(Wireless Networking)
echo     a 开启服务器备份(Windows Server Backup)
echo     b 开启音频服务
echo     c 禁用“显示“关闭事件跟踪程序””
echo     d 在登录时不启动服务器管理器
echo     e 添加VHD(X)引导项
echo     f 删除引导项
echo     g 清除远程桌面连接记录
echo     h 清除远程桌面连接记录(WS2003)
echo     0 返回

echo.
set /p choice="请输入对应版本前面的字符串并敲回车:"
if %choice%==1 call :rdp & echo. & echo 按任意键返回... & pause >nul & cls & goto :tools
if %choice%==2 call :3389 & echo. & echo 按任意键返回... & pause >nul & cls & goto :tools
if %choice%==3 call :AutoLogonAndLockWorkStation & echo. & echo 按任意键返回... & pause >nul & cls & goto :tools
if %choice%==4 call :close_service & echo. & echo 按任意键返回... & pause >nul & cls & goto :tools
if %choice%==5 call :macfetch & echo. & echo 按任意键返回... & pause >nul & cls & goto :tools
if %choice%==6 dism /online  /Cleanup-Image /StartComponentCleanup & echo. & echo 按任意键返回... & pause >nul & cls & goto :tools
if %choice%==7 diskperf -y & echo. & echo 按任意键返回... & pause >nul & cls & goto :tools
if %choice%==8 PowerShell /Command "&{Add-WindowsFeature Desktop-Experience}" & echo. & echo 按任意键返回... & pause >nul & cls & goto :tools
if %choice%==9 PowerShell /Command "&{Add-WindowsFeature Wireless-Networking}" & echo. & echo 按任意键返回... & pause >nul & cls & goto :tools
if %choice%==a PowerShell /Command "&{Add-WindowsFeature Windows-Server-Backup}" & echo. & echo 按任意键返回... & pause >nul & cls & goto :tools
if %choice%==b sc config Audiosrv start= auto & sc start Audiosrv & echo. & echo 按任意键返回... & pause >nul & cls & goto :tools
if %choice%==c reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Reliability" /v ShutdownReasonOn /t REG_DWORD /d 0 /f & echo. & echo 按任意键返回... & pause >nul & cls & goto :tools
if %choice%==d reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ServerManager" /v DoNotOpenServerManagerAtLogon /t REG_DWORD /d 1 /f & echo. & echo 按任意键返回... & pause >nul & cls & goto :tools
if %choice%==e call :bcdeditaddvhd & echo. & echo 按任意键返回... & pause >nul & cls & goto :tools
if %choice%==f call :bcdeditremovevhd & echo. & echo 按任意键返回... & pause >nul & cls & goto :tools
if %choice%==g reg delete "HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Default" /va /f & del "%USERPROFILE%\Documents\Default.rdp" /a & del "%APPDATA%\Microsoft\Windows\Recent\AutomaticDestinations" /q & echo. & echo 按任意键返回... & pause >nul & cls & goto :tools
if %choice%==h reg delete "HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Default" /va /f & del "%USERPROFILE%\My Documents\Default.rdp" /a  & echo. & echo 按任意键返回... & pause >nul & cls & goto :tools
if %choice%==0 goto :main
goto :tools


rem 自动激活 Windows 和 Office
:autoat
call :kmsserver_select
echo.
echo 准备激活 Windows:
echo 第1次尝试:
echo 第1步 设置密钥管理服务计算机名称
cscript /nologo %windir%\System32\slmgr.vbs /skms %KMSServer%
echo 第2步 联网激活
cscript /nologo %windir%\System32\slmgr.vbs /ato
if %ERRORLEVEL% equ -1073418124 (
echo ------ KMS服务器连接不上,请检查网络是否正常或稍后再试 ------
echo.
)
if ERRORLEVEL 0 (
echo ------ 激活成功 ------
rem goto :eof
)
echo.
echo 准备激活 Office:
FOR /F "tokens=1,2,* delims= " %%i in ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Winword.exe" /v "Path" 2^>^>%LogFileName%') do set OfficePath=%%k
if "%OfficePath%"=="" (
echo 没有安装 Office
) else (
cscript /nologo %OfficePath%ospp.vbs /act | find /i /v "successful" >nul 2>>%LogFileName% && echo 成功地激活了产品。 || echo 产品激活失败。
)
goto :eof
exit
echo 第2次尝试:
echo 第1步 设置密钥管理服务计算机名称
ipconfig /flushdns>>nul
cscript /nologo %windir%\System32\slmgr.vbs /ckms>>nul
cscript /nologo %windir%\System32\slmgr.vbs /skms %KMSServer%
echo 第2步 联网激活
cscript /nologo %windir%\System32\slmgr.vbs /ato
if %ERRORLEVEL% equ -1073418124 (
echo ------ KMS服务器连接不上,请检查网络是否正常或稍后再试 ------
echo.
)
if ERRORLEVEL 0 (
echo ------ 激活成功 ------
goto :eof
)
echo 第3次尝试:
FOR /F "tokens=1,2,* delims= " %%i in ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "ProductName" 2^>^>%LogFileName%') do set OSNameFromReg=%%k
echo %OSNameFromReg% >>%LogFileName%
set TagNameOS=%OSNameFromReg: =%
call :%TagNameOS% 2>>%LogFileName%
if ERRORLEVEL 1 (
echo 无法激活 %OSNameFromReg%
)
echo.
echo 准备激活 Office:
FOR /F "tokens=1,2,* delims= " %%i in ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Winword.exe" /v "Path" 2^>^>%LogFileName%') do set OfficePath=%%k
if "%OfficePath%"=="" (
echo 没有安装 Office
) else (
FOR /F "tokens=1-5 delims=\\" %%l in ("!OfficePath!") do set OfficeNameFromReg=%%o
set TagNameOffice=!OfficeNameFromReg!
call :!TagNameOffice! 2>>%LogFileName%
if ERRORLEVEL 1 (
echo 无法激活 Office !OfficeNameFromReg!
)
)
goto :eof
exit

rem 选择kms服务器
:kmsserver_select
if defined KMSServer0 set KMSServer=%KMSServer0% & goto :eof & exit
cls
title KMS Server Select
echo ------ KMS Server Select ------
echo.
echo     1 %KMSServer1%
echo     2 %KMSServer2%
echo     3 %KMSServer3%
echo     4 %KMSServer4%
echo     5 %KMSServer5%
echo     5 %KMSServer6%
echo     0 返回

echo.
set /p choice="请输入KMS服务器地址或从备用列表选择并敲回车(默认为1):"
set KMSServer=%choice%
if %choice%==1 set KMSServer=%KMSServer1%
if %choice%==2 set KMSServer=%KMSServer2%
if %choice%==3 set KMSServer=%KMSServer3%
if %choice%==4 set KMSServer=%KMSServer4%
if %choice%==5 set KMSServer=%KMSServer5%
if %choice%==5 set KMSServer=%KMSServer6%
if %choice%==0 goto :main
goto :eof
exit


rem ----------------------------------------------
:Windows10Pro
set Name=Windows 10 Pro
set OSName=Windows 10 Pro
set ProductKey=W269N-WFGWX-YVC9B-4J6C9-T83GX
call :atos
goto :eof
exit

:Windows10Enterprise
set Name=Windows 10 Enterprise
set OSName=Windows 10 Enterprise
set ProductKey=NPPR9-FWDCX-D2C8J-H872K-2YT43
call :atos
goto :eof
exit

:Windows8.1Pro
set Name=Windows 8.1 Pro
set OSName=Windows 8.1 Pro
set ProductKey=GCRJD-8NW9H-F2CDX-CCM8D-9D6T9
call :atos
goto :eof
exit

:Windows8.1Enterprise
set Name=Windows 8.1 Enterprise
set OSName=Windows 8.1 Enterprise
set ProductKey=MHF9N-XY6XB-WVXMC-BTDCT-MKKG7
call :atos
goto :eof
exit

:WindowsServer2012R2Standard
set Name=Windows Server 2012 R2 Standard
set OSName=Windows Server 2012 R2 Standard
set ProductKey=D2N9P-3P6X9-2R39C-7RTCD-MDVJX
call :atos
goto :eof
exit

:WindowsServer2012R2Datacenter
set Name=Windows Server 2012 R2 Datacenter
set OSName=Windows Server 2012 R2 Datacenter
set ProductKey=W3GGN-FT8W3-Y4M27-J84CP-Q3VJ9
call :atos
goto :eof
exit

:Windows8Pro
set Name=Windows 8 Professional
set OSName=Windows 8 Pro
set ProductKey=NG4HW-VH26C-733KW-K6F98-J8CK4
call :atos
goto :eof
exit

:Windows8Enterprise
set Name=Windows 8 Enterprise
set OSName=Windows 8 Enterprise
set ProductKey=32JNW-9KQ84-P47T8-D8GGY-CWCK7
call :atos
goto :eof
exit

:WindowsServer2012Standard
set Name=Windows Server 2012 Standard
set OSName=Windows Server 2012 Standard
set ProductKey=XC9B7-NBPP2-83J2H-RHMBY-92BT4
call :atos
goto :eof
exit

:WindowsServer2012Datacenter
set Name=Windows Server 2012 Datacenter
set OSName=Windows Server 2012 Datacenter
set ProductKey=48HP8-DN98B-MYWDG-T2DCC-8W83P
call :atos
goto :eof
exit

:WindowsServer2008R2Enterprise
set Name=Windows Server 2008 R2 Enterprise
set OSName=Windows Server 2008 R2 Enterprise
set ProductKey=489J6-VHDMP-X63PK-3K798-CPX3Y
call :atos
goto :eof
exit

:Windows7Professional
set Name=Windows 7 Professional
set OSName=Windows 7 Professional
set ProductKey=FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4
call :atos
goto :eof
exit

:Windows7Enterprise
set Name=Windows 7 Enterprise
set OSName=Windows 7 Enterprise
set ProductKey=33PXH-7Y6KF-2VJC9-XBBR8-HVTHH
call :atos
goto :eof
exit

:atos
rem 激活操作系统
call :kmsserver_select
title 激活 %Name%
echo.
echo ------ 激活 %Name% ------
echo.
rem 手动激活需要单独获取一次
if "%OSNameFromReg%"=="" (
FOR /F "tokens=1,2,* delims= " %%i in ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "ProductName" 2^>^>%LogFileName%') do set OSNameFromReg=%%k
)
rem 如果版本号不匹配,说明用户选择错误,仅针对手动
if not "%OSName%"=="%OSNameFromReg%" (
echo 您选择的版本:%OSName%
echo 您安装的版本:%OSNameFromReg%
echo 系统检测到您选择的和您安装的版本不符,请返回重新选择
goto :eof
)
echo 第一步、设置密钥管理服务计算机名称
ipconfig /flushdns>>nul
cscript /nologo %windir%\System32\slmgr.vbs /ckms>>nul
cscript /nologo %windir%\System32\slmgr.vbs /skms %KMSServer%
echo 第二步、安装产品密钥
cscript /nologo %windir%\System32\slmgr.vbs /ipk %ProductKey%
echo 第三步、联网激活
cscript /nologo %windir%\System32\slmgr.vbs /ato
echo ------ 激活 %Name% 执行完毕 ------
title 激活 %Name% 完毕
goto :eof
rem ----------------------------------------------



rem ----------------------------------------------
:Office16
set Name=Office 2016 VL
set OfficeName=Office16
set ProductKey=XQNVK-8JYDB-WJ9W3-YJ8YR-WFG99
call :atoffice
goto :eof
exit

:Office15
set Name=Office 2013 VL
set OfficeName=Office15
set ProductKey=YC7DK-G2NP3-2QQC3-J6H88-GVGXT
call :atoffice
goto :eof
exit


:Office14
set Name=Office 2010 VL
set OfficeName=Office14
set ProductKey=YC7DK-G2NP3-2QQC3-J6H88-GVGXT
call :atoffice
goto :eof
exit


:atoffice
rem 激活Office
call :kmsserver_select
title 激活 %Name%
echo.
echo ------ 激活 %Name% ------
echo.
rem 手动激活需要单独获取一次
if "%OfficePath%"=="" (
FOR /F "tokens=1,2,* delims= " %%i in ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Winword.exe" /v "Path" 2^>^>%LogFileName%') do set OfficePath=%%k
FOR /F "tokens=1-5 delims=\\" %%l in ("!OfficePath!") do set OfficeNameFromReg=%%o
)
rem 如果获取之后还是为空,说明没有安装,仅针对手动
if "%OfficePath%"=="" (
echo 系统检测到您没有安装 %Name% 产品
goto :eof
)
rem 如果版本号不匹配,说明用户选择错误,仅针对手动
if not "%OfficeName%"=="%OfficeNameFromReg%" (
echo 您选择的版本:%OfficeName%
echo 您安装的版本:%OfficeNameFromReg%
echo 系统检测到您选择的和您安装的版本不符,请返回重新选择
goto :eof
)
set osppFile="%OfficePath%ospp.vbs"
echo 第一步、设置密钥管理服务计算机名称
ipconfig /flushdns >nul 2>nul
cscript /nologo %osppFile% /remhst >nul 2>>%LogFileName%
cscript /nologo %osppFile% /sethst:%KMSServer% >nul 2>>%LogFileName%
echo 密钥管理服务计算机名称成功地设置为 %KMSServer%。
echo.
echo 第二步、安装产品密钥
cscript /nologo %osppFile% /inpkey:%ProductKey% | find /i "successful" >nul 2>>%LogFileName% && echo 成功地安装了产品密钥 %ProductKey%。 || echo 产品序列号无效或设置失败。
echo.
echo 第三步、联网激活
cscript /nologo %osppFile% /act | find /i /v "successful" >nul 2>>%LogFileName% && echo 成功地激活了产品。 || echo 产品激活失败。
echo.
echo ------ 激活 %Name% 执行完毕 ------
title 激活 %Name% 完毕
goto :eof
rem ----------------------------------------------


rem ----------------------------------------------
:list
title 可激活的操作系统和Office列表
echo Office
echo Office 2016                                       XQNVK-8JYDB-WJ9W3-YJ8YR-WFG99
echo Office 2013                                       YC7DK-G2NP3-2QQC3-J6H88-GVGXT
echo Office 2010                                       YC7DK-G2NP3-2QQC3-J6H88-GVGXT
echo.
echo Windows 10 and Windows Server 2016
echo Windows 10 Home                                   TX9XD-98N7V-6WMQ6-BX7FG-H8Q99
echo Windows 10 Home N                                 3KHY7-WNT83-DGQKR-F7HPR-844BM
echo Windows 10 Home Single Language                   7HNRX-D7KGG-3K4RQ-4WPJ4-YTDFH
echo Windows 10 Home Country Specific                  PVMJN-6DFY6-9CCP6-7BKTT-D3WVR
echo Windows 10 Professional                           W269N-WFGWX-YVC9B-4J6C9-T83GX
echo Windows 10 Professional N                         MH37W-N47XK-V7XM9-C7227-GCQG9
echo Windows 10 Education                              NW6C2-QMPVW-D7KKK-3GKT6-VCFB2
echo Windows 10 Education N                            2WH4N-8QGBV-H22JP-CT43Q-MDWWJ
echo Windows 10 Enterprise                             NPPR9-FWDCX-D2C8J-H872K-2YT43
echo Windows 10 Enterprise N                           DPH2V-TTNVB-4X9Q3-TJR4H-KHJW4
echo Windows 10 Enterprise 2015 LTSB                   WNMTR-4C88C-JK8YV-HQ7T2-76DF9
echo Windows 10 Enterprise 2015 LTSB N                 2F77B-TNFGY-69QQF-B8YKP-D69TJ
echo.
echo Windows 8.1 and Windows Server 2012 R2
echo Windows 8.1 Professional (明确支持)               GCRJD-8NW9H-F2CDX-CCM8D-9D6T9
echo Windows 8.1 Professional N                        HMCNV-VVBFX-7HMBH-CTY9B-B4FXY
echo Windows 8.1 Enterprise (明确支持)                 MHF9N-XY6XB-WVXMC-BTDCT-MKKG7
echo Windows 8.1 Enterprise N                          TT4HM-HN7YT-62K67-RGRQJ-JFFXW
echo Windows Embedded 8.1 Industry Pro (明确支持)
echo Windows Embedded 8.1 Industry Enterprise (明确支持)
echo Windows Server 2012 R2 Server Standard (明确支持) D2N9P-3P6X9-2R39C-7RTCD-MDVJX
echo Windows Server 2012 R2 Datacenter (明确支持)      W3GGN-FT8W3-Y4M27-J84CP-Q3VJ9
echo Windows Server 2012 R2 Essentials                 KNC87-3J2TX-XB4WP-VCPJV-M4FWM
echo.
echo Windows 8 and Windows Server 2012
echo Windows 8 Professional (明确支持)                 NG4HW-VH26C-733KW-K6F98-J8CK4
echo Windows 8 Professional N                          XCVCF-2NXM9-723PB-MHCB7-2RYQQ
echo Windows 8 Enterprise (明确支持)                   32JNW-9KQ84-P47T8-D8GGY-CWCK7
echo Windows 8 Enterprise N                            JMNMF-RHW7P-DMY6X-RF3DR-X2BQT
echo Windows Server 2012 (明确支持)                    BN3D2-R7TKB-3YPBD-8DRP2-27GG4
echo Windows Server 2012 N                             8N2M2-HWPGY-7PGT9-HGDD8-GVGGY
echo Windows Server 2012 Single Language               2WN2H-YGCQR-KFX6K-CD6TF-84YXQ
echo Windows Server 2012 Country Specific              4K36P-JN4VD-GDC6V-KDT89-DYFKP
echo Windows Server 2012 Server Standard (明确支持)    XC9B7-NBPP2-83J2H-RHMBY-92BT4
echo Windows Server 2012 MultiPoint Standard           HM7DN-YVMH3-46JC3-XYTG7-CYQJJ
echo Windows Server 2012 MultiPoint Premium            XNH6W-2V9GX-RGJ4K-Y8X6F-QGJ2G
echo Windows Server 2012 Datacenter (明确支持)         48HP8-DN98B-MYWDG-T2DCC-8W83P
echo.
echo Windows 7 and Windows Server 2008 R2
echo Windows 7 Professional (明确支持)                 FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4
echo Windows 7 Professional N                          MRPKT-YTG23-K7D7T-X2JMM-QY7MG
echo Windows 7 Professional E                          W82YF-2Q76Y-63HXB-FGJG9-GF7QX
echo Windows 7 Enterprise (明确支持)                   33PXH-7Y6KF-2VJC9-XBBR8-HVTHH
echo Windows 7 Enterprise N                            YDRBP-3D83W-TY26F-D46B2-XCKRJ
echo Windows 7 Enterprise E                            C29WB-22CC8-VJ326-GHFJW-H9DH4
echo Windows Embedded Standard (明确支持)
echo Windows Server 2008 R2 Web                        6TPJF-RBVHG-WBW2R-86QPH-6RTM4
echo Windows Server 2008 R2 HPC edition                TT8MH-CG224-D3D7Q-498W2-9QCTX
echo Windows Server 2008 R2 Standard                   YC6KT-GKW9T-YTKYR-T4X34-R7VHC
echo Windows Server 2008 R2 Enterprise (明确支持)      489J6-VHDMP-X63PK-3K798-CPX3Y
echo Windows Server 2008 R2 Datacenter                 74YFP-3QFB3-KQT8W-PMXWJ-7M648
echo Windows Server 2008 R2 for Itanium-based Systems  GT63C-RJFQ3-4GMB6-BRFB9-CB83V
echo.
echo Windows Vista and Windows Server 2008
echo Windows Vista Business                            YFKBB-PQJJV-G996G-VWGXY-2V3X8
echo Windows Vista Business N                          HMBQG-8H2RH-C77VX-27R82-VMQBT
echo Windows Vista Enterprise                          VKK3X-68KWM-X2YGT-QR4M6-4BWMV
echo Windows Vista Enterprise N                        VTC42-BM838-43QHV-84HX6-XJXKV
echo Windows Web Server 2008                           WYR28-R7TFJ-3X2YQ-YCY4H-M249D
echo Windows Server 2008 Standard                      TM24T-X9RMF-VWXK6-X8JC9-BFGM2
echo Windows Server 2008 Standard without Hyper-V      W7VD6-7JFBR-RX26B-YKQ3Y-6FFFJ
echo Windows Server 2008 Enterprise                    YQGMW-MPWTJ-34KDK-48M3W-X4Q6V
echo Windows Server 2008 Enterprise without Hyper-V    39BXF-X8Q23-P2WWT-38T2F-G3FPG
echo Windows Server 2008 HPC                           RCTX3-KWVHP-BR6TB-RB6DM-6X7HP
echo Windows Server 2008 Datacenter                    7M67G-PC374-GR742-YH8V4-TCBY3
echo Windows Server 2008 Datacenter without Hyper-V    22XQ2-VRXRG-P8D42-K34TD-G3QQC
echo Windows Server 2008 for Itanium-Based Systems     4DWFP-JF3DJ-B7DTH-78FJB-PDRHK

FOR /F "tokens=1,2,* delims= " %%i in ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "ProductName" 2^>^>%LogFileName%') do echo 您的系统是:%%k

goto :eof
rem ----------------------------------------------



rem ----------------------------------------------
:rdp
@echo off
:: Code by xy 2013-01-10, 11,03-26

title 开启远程桌面 Code by xy 2013-01-10, 11,03-26

echo ------ 开启远程桌面 ------
echo 说明:
echo 1.本脚本能够开启远程桌面功能、设定远程桌面端口、
echo   添加防火墙规则并禁用3389端口等的一系列功能,
echo   并且不需要重新启动系统即可生效。
echo 2.本脚本在 Windows Server 2012 DataCenter 简体中文版上测试成功。
echo   理论上也支持 WS2012、WS2008R2、WS2008、Win8、Win7、Vista 全系列64位、32位版本。
echo   对于 WS2003、WinXP 等不支持高级防火墙的需要修改本脚本中防火墙相关命令。
echo   对于非简体中文版本需要修改本脚本中防火墙相关命令。
echo 3.请右键以管理员身份运行,如果没有请关闭本窗口,重新运行。
echo 4.执行完毕之后会有提示,请耐心等待。
echo.
echo ------ 执行 ------
echo.

echo 备份相关注册表项到 3389.reg.bak :
reg export "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" 3389.reg.%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%.bak
echo.

set /p port=请输入端口:
echo.

echo 删除原端口防火墙规则...
rem set /a n=0xff 转换16进制到10进制并赋予变量n
for /f "tokens=3" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp" /v PortNumber^|find /i "PortNumber"
') do set /a pn=%%a
if not %pn%==3389 (
netsh advfirewall firewall delete rule name=all protocol=tcp localport=%pn%
netsh advfirewall firewall delete rule name=all protocol=udp localport=%pn%
)
for /f "tokens=3" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v PortNumber^|find /i "PortNumber"
') do set /a pn=%%a
if not %pn%==3389 (
netsh advfirewall firewall delete rule name=all protocol=tcp localport=%pn%
netsh advfirewall firewall delete rule name=all protocol=udp localport=%pn%
)
echo.

echo 添加新端口防火墙规则...
netsh advfirewall firewall add rule name="%port% - rdp (TCP-In)" dir=in action=allow protocol=TCP localport=%port%
netsh advfirewall firewall add rule name="%port% - rdp (UDP-In)" dir=in action=allow protocol=UDP localport=%port%
echo.

echo 禁用3389端口...
netsh advfirewall firewall set rule group="远程桌面" new enable=no
echo.

echo 正在修改端口...
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp" /v PortNumber /t REG_DWORD /d %port% /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v PortNumber /t REG_DWORD /d %port% /f
echo.

echo 正在启用远程桌面功能,稍后会断开连接...
echo 请稍后使用新端口手动连接...
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
echo.

echo 正在重启远程桌面服务...
net stop "Remote Desktop Services" /y
net start "Remote Desktop Services"
echo.

echo 执行完毕
pause >nul
goto :eof
exit


:3389
@echo off
:: Code by xy 2013-01-10, 11

title 开启远程桌面 Code by xy 2013-01-10, 11

echo ------ 开启远程桌面 ------
echo 注意:
echo 1.请先添加防火墙规则!!!
echo 2.切记第一条!!!
echo 3.仔细看下面的说明!!!
echo 说明:
echo 1.本脚本能够开启远程桌面功能、设定远程桌面端口,但需要重启才能生效。
echo 2.本脚本在 Windows Server 2012 DataCenter 简体中文版上测试成功。
echo   理论上也支持 WS12、WS08、WS03、W8、W7、Vista、XP 全系列64位、32位版本。
echo 3.执行完毕之后会有提示,请耐心等待。
echo.
echo ------ 执行 ------
echo.
set /p port=请输入端口:
echo.
echo 正在修改端口...
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp" /v PortNumber /t REG_DWORD /d %port% /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v PortNumber /t REG_DWORD /d %port% /f
echo.
echo 正在启用远程桌面功能...
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
echo.
echo 执行完毕
goto :eof
exit

:bcdeditaddvhd
@echo off
:: Code by xy 2014-10-15

title 添加VHD(X)引导项 Code by xy 2014-10-15

@echo off
set /p bootname=请输入引导项名称:
set /p vhdname=请输入VHD(X)的文件名,包含盘符和路径:
for /f "tokens=1,2 delims=:" %%a in ("%vhdname%") do (set vhdname_partition=%%a& set vhdname_pathfilename=%%b)
for /f "tokens=2 delims={}"  %%i in ('bcdedit /copy {current} /d "%bootname%"') do (set guid=%%i)
bcdedit /set {%guid%} device vhd=[%vhdname_partition%:]%vhdname_pathfilename%
bcdedit /set {%guid%} osdevice vhd=[%vhdname_partition%:]%vhdname_pathfilename%
bcdedit /set {%guid%} detecthal on
echo 执行完毕
goto :eof
exit

:bcdeditremovevhd
@echo off
:: Code by xy 2014-10-15

title 删除引导项 Code by xy 2014-10-15

echo ------ 删除引导项 ------
echo 说明:
echo 1.将要删除的引导项的guid复制粘贴到本脚本所在目录下的guid.txt文件里。
echo 2.每行一个。
echo.
echo 按任意键开始删除
pause >nul
echo ------ 执行 ------
echo.
for /f "tokens=1" %%a in (guid.txt) do (bcdedit /delete %%a)
echo.
echo 执行完毕
goto :eof
exit

:AutoLogonAndLockWorkStation
@echo off
:: Code by xy 2013-09-13

title 设定开机自动登陆并锁定系统 Code by xy 2013-09-13

start control userpasswords2

ver | findstr "5\.[0-9]\.[0-9][0-9]*" > nul && goto winnt5x
ver | findstr "6\.[0-9]\.[0-9][0-9]*" > nul && goto winnt6x

:winnt5x
echo rundll32.exe user32.dll,LockWorkStation > "%USERPROFILE%\「开始」菜单\程序\启动\LockWorkStation.bat"
explorer.exe "%USERPROFILE%\「开始」菜单\程序\启动\"
echo 执行完毕
goto :eof
exit

:winnt6x
echo rundll32.exe user32.dll,LockWorkStation > "%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\LockWorkStation.bat"
explorer.exe "%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\"
echo 执行完毕
goto :eof
exit

:close_service
@echo off
:: Code by xy 2013-04-12

title 关闭服务使系统更安全 Code by xy 2013-04-12

sc stop Browser
sc stop Spooler
sc stop RemoteRegistry
sc stop LanmanServer
sc stop ShellHWDetection
sc stop Schedule
sc stop lmhosts
sc stop LanmanWorkstation

sc config Browser start= disabled
sc config Spooler start= disabled
sc config RemoteRegistry start= disabled
sc config LanmanServer start= disabled
sc config ShellHWDetection start= disabled
sc config Schedule start= disabled
sc config lmhosts start= disabled
sc config LanmanWorkstation start= disabled

echo 执行完毕
goto :eof
exit

:macfetch
@echo off
:: Code by xy 2013-09-23

title 获取网卡MAC地址 Code by xy 2013-09-23

:op
cls
echo 1.获取MAC地址并输出到指定文件
echo 2.整理MAC地址并复制到剪贴板
echo 0.返回
echo.
set op=
set /p op=    输入选项后按回车键:
if "%op%"=="1" goto FETCHMAC
if "%op%"=="2" goto CLEARMAC
if "%op%"=="0" goto tools
cls
GOTO op

:FETCHMAC
echo.
set /p name=Your name: 
ipconfig /all > mac_%name%.txt
echo MAC address has been saved in mac_%name%.txt
pause
cls
GOTO op

:CLEARMAC
echo.
echo 输入0返回
echo.
set /p name=Your MAC: 
if %name%==0 goto :op
set name=%name:-=%
echo Clean MAC: %name%
mshta vbscript:clipboarddata.setdata("text","%name%")(close)
GOTO CLEARMAC
rem ----------------------------------------------

:checkver
echo.
FOR /F "tokens=1,2,* delims= " %%i in ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "ProductName" 2^>^>%LogFileName%') do set OSNameFromReg=%%k
echo 您的 Windows 版本为:%OSNameFromReg% (OSNameFromReg)
echo 您的 Windows 版本为:%OSNameFromReg% (OSNameFromReg) >> %LogFileName%
mshta vbscript:clipboarddata.setdata("text","我的 Windows 版本为:%OSNameFromReg% (OSNameFromReg)")(close)
echo Windows 版本名称已复制到剪贴板,请粘贴到群里或评论区报告给作者,谢谢!
goto :eof
exit