@ECHO OFF
setlocal ENABLEDELAYEDEXPANSIONshell
::mode con: cols=65 lines=25
color 0A服務器
:: 批處理獲取管理員權限
:-------------------------------------
%1 mshta vbscript:createobject("shell.application").shellexecute("""%~0""","::",,"runas",1)(window.close)&&exit /b
pushd "%CD%"
CD /D "%~dp0"
:--------------------------------------
set BatPath=%~dp0
set BatPath=%BatPath:~0,-1%
for /f "tokens=6 delims=[]. " %%G in ('ver') do set win=%%Gmarkdown
rem 判斷32/64位
set "ospp=%ProgramFiles%\Microsoft Office\Office15\ospp.vbs"
if not exist "%ospp%" (
set "ospp=%ProgramFiles(x86)%\Microsoft Office\Office15\ospp.vbs"
)
:-------------------------------------- app
:設置變量===============================
set ip=172.19.34.146ide
:開始KMS服務器==========================token
:172.19.32.146
if %errorlevel% EQU 0 (
echo 鏈接 KMS 服務器:%ip% 成功!
echo.
) else ( goto :172.19.34.146 )ip
:開始激活===============================
ECHO.Office 正在激活……rem
::卸載已安裝的產品密鑰。後面的數字是密鑰的最後5位數。
::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 >nulit
cscript "%ospp%" /sethst:%ip% >nul
cscript "%ospp%" /act
pause
:dstatus
cls
echo Office 激活狀態……
cscript "%ospp%" /dstatus
pause
goto :Exit:Exit