系列文章:
由於彰化縣KMS將於2021年11月1日停止服務,資訊組就人仰馬翻要去處理電腦Windows與Office認證。希望能夠只要滑鼠點兩下,讓電腦開機時就完成Windows與Office雙認證,不需要資訊組再去處理。那如果想要電腦開機時就完成Windows與Office雙認證,也只要點兩下就好。後來再度發現,認證視窗會一直留著,需要人工去關閉。可否2秒後,該認證視窗就自動關閉。不需要人工再去處理。
範例檔案下載,解壓密碼demo1234
教學影片:
此外,針對縣網版本Office認證BAT,進行比對。發現chcoffice2016_kms.bat 與 chcoffice2019_kms.bat 的內容 只有6與9的差別。換言之,office2019的認證可以用chcoffice2016_kms.bat 進行認證。
目的:完成Windows 10 認證後兩秒自動關閉
檔案名稱:chcwin10_kms.bat
內容:
@echo off
REM ---------------以下是程式碼,不需更改---------------
REM :: BatchGotAdmin (Run as Admin code starts)
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
REM :: BatchGotAdmin (Run as Admin code ends)
REM :: Your codes should start from the following line
echo @
echo @ 彰化縣網Windows 10系統認證中,請稍候......
echo @ 本程式僅限用Windows 10 Enterprise 版本
echo @
echo @
echo @
cscript c:\windows\system32\slmgr.vbs -skms 163.23.200.140
cscript c:\windows\system32\slmgr.vbs -ato
echo @
echo @
echo @
echo @ 若是出現Product activated successfully訊息,
echo @ 代表Windows 10作業系統已經啟用成功,
echo @ 提醒您,每180天必須將系統重新啟用一次!!
echo @
echo @ 本程式僅限縣內國中小使用,
echo @ 有任何問題,請直接洽詢彰化縣網中心。
echo @ 祝您使用愉快!
echo @ 彰化縣網中心
echo.
timeout /t 2
目的:完成Windows 7 認證後兩秒自動關閉
檔案名稱:chcwin7_kms.bat
內容:
@echo off
REM ---------------以下是程式碼,不需更改---------------
REM :: BatchGotAdmin (Run as Admin code starts)
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
REM :: BatchGotAdmin (Run as Admin code ends)
REM :: Your codes should start from the following line
echo @
echo @ 彰化縣網Windows 7系統認證中,請稍候......
echo @ 本程式僅限用Windows 7 Enterprise 版本
echo @
echo @
echo @
cscript c:\windows\system32\slmgr.vbs -skms 163.23.200.140
cscript c:\windows\system32\slmgr.vbs -ato
echo @
echo @
echo @
echo @ 若是出現Product activated successfully訊息,
echo @ 代表Windows 7作業系統已經啟用成功,
echo @ 提醒您,每180天必須將系統重新啟用一次!!
echo @
echo @ 本程式僅限縣內國中小使用,
echo @ 有任何問題,請直接洽詢彰化縣網中心。
echo @ 祝您使用愉快!
echo @ 彰化縣網中心
echo.
timeout /t 2
目的:完成Office2010 認證後兩秒自動關閉
檔案名稱:chcoffice2010_kms.bat
內容:
@echo off
timeout /t 2
REM ---------------以下是程式碼,不需更改---------------
REM :: BatchGotAdmin (Run as Admin code starts)
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
REM :: BatchGotAdmin (Run as Admin code ends)
REM :: Your codes should start from the following line
echo 偵測 Microsoft Office 2010 安裝目錄
set OfficePath="C:\Program Files\Microsoft Office\Office14\"
if exist "C:\Program Files (x86)\Microsoft Office\Office14\ospp.vbs" set OfficePath="C:\Program Files (x86)\Microsoft Office\Office14\"
For /F "tokens=2 delims=[]" %%G in ('ver') Do (set _version=%%G)
For /F "tokens=2 delims=. " %%G in ('echo %_version%') Do (set _major=%%G)
if "%_major%"=="5" (echo 重啟 KMS 金鑰管理伺服器
cscript %OfficePath%ospp.vbs /osppsvcrestart)
echo 設定 KMS 金鑰管理伺服器
cscript %OfficePath%ospp.vbs /sethst:163.23.200.140
cscript %OfficePath%ospp.vbs /setprt:1688
echo 啟動 Microsoft Office 2010
cscript %OfficePath%ospp.vbs /act
echo 啟動程序執行完成
echo 請注意: 上方(約前五行)需有 Product activation successful 出現,
echo 才表示您的 Office2010 啟動成功!
timeout /t 2
目的:完成Office2013 認證後兩秒自動關閉
檔案名稱:chcoffice2013_kms.bat
內容:
@echo off
timeout /t 2
REM ---------------以下是程式碼,不需更改---------------
REM :: BatchGotAdmin (Run as Admin code starts)
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
REM :: BatchGotAdmin (Run as Admin code ends)
REM :: Your codes should start from the following line
echo 偵測 Microsoft Office 2013 安裝目錄
set OfficePath="C:\Program Files\Microsoft Office\Office15\"
if exist "C:\Program Files (x86)\Microsoft Office\Office15\ospp.vbs" set OfficePath="C:\Program Files (x86)\Microsoft Office\Office15\"
For /F "tokens=2 delims=[]" %%G in ('ver') Do (set _version=%%G)
For /F "tokens=2 delims=. " %%G in ('echo %_version%') Do (set _major=%%G)
if "%_major%"=="5" (echo 重啟 KMS 金鑰管理伺服器
cscript %OfficePath%ospp.vbs /osppsvcrestart)
echo 設定 KMS 金鑰管理伺服器
cscript %OfficePath%ospp.vbs /sethst:163.23.200.140
cscript %OfficePath%ospp.vbs /setprt:1688
echo 啟動 Microsoft Office 2013
cscript %OfficePath%ospp.vbs /act
echo 啟動程序執行完成
echo 請注意: 上方(約前五行)需有 Product activation successful 出現,
echo 才表示您的 Office2013 啟動成功!
timeout /t 2
目的:完成Office2016 認證後兩秒自動關閉
檔案名稱:chcoffice2016_kms.bat
內容:
@echo off
timeout /t 2
REM ---------------以下是程式碼,不需更改---------------
REM :: BatchGotAdmin (Run as Admin code starts)
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
REM :: BatchGotAdmin (Run as Admin code ends)
REM :: Your codes should start from the following line
echo 偵測 Microsoft Office 2016 安裝目錄
set OfficePath="C:\Program Files\Microsoft Office\Office16\"
if exist "C:\Program Files (x86)\Microsoft Office\Office16\ospp.vbs" set OfficePath="C:\Program Files (x86)\Microsoft Office\Office16\"
For /F "tokens=2 delims=[]" %%G in ('ver') Do (set _version=%%G)
For /F "tokens=2 delims=. " %%G in ('echo %_version%') Do (set _major=%%G)
if "%_major%"=="5" (echo 重啟 KMS 金鑰管理伺服器
cscript %OfficePath%ospp.vbs /osppsvcrestart)
echo 設定 KMS 金鑰管理伺服器
cscript %OfficePath%ospp.vbs /sethst:163.23.200.140
cscript %OfficePath%ospp.vbs /setprt:1688
echo 啟動 Microsoft Office 2016
cscript %OfficePath%ospp.vbs /act
echo 啟動程序執行完成
echo 請注意: 上方(約前五行)需有 Product activation successful 出現,
echo 才表示您的 Office2016 啟動成功!
timeout /t 2
目的:完成Office2019 認證後兩秒自動關閉
檔案名稱:chcoffice2019_kms.bat
內容:
@echo off
timeout /t 2
REM ---------------以下是程式碼,不需更改---------------
REM :: BatchGotAdmin (Run as Admin code starts)
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
REM :: BatchGotAdmin (Run as Admin code ends)
REM :: Your codes should start from the following line
echo 偵測 Microsoft Office 2019 安裝目錄
set OfficePath="C:\Program Files\Microsoft Office\Office16\"
if exist "C:\Program Files (x86)\Microsoft Office\Office16\ospp.vbs" set OfficePath="C:\Program Files (x86)\Microsoft Office\Office16\"
For /F "tokens=2 delims=[]" %%G in ('ver') Do (set _version=%%G)
For /F "tokens=2 delims=. " %%G in ('echo %_version%') Do (set _major=%%G)
if "%_major%"=="5" (echo 重啟 KMS 金鑰管理伺服器
cscript %OfficePath%ospp.vbs /osppsvcrestart)
echo 設定 KMS 金鑰管理伺服器
cscript %OfficePath%ospp.vbs /sethst:163.23.200.140
cscript %OfficePath%ospp.vbs /setprt:1688
echo 啟動 Microsoft Office 2019
cscript %OfficePath%ospp.vbs /act
echo 啟動程序執行完成
echo 請注意: 上方(約前五行)需有 Product activation successful 出現,
echo 才表示您的 Office2019 啟動成功!
timeout /t 2
資料來源:
沒有留言:
張貼留言