Created
February 9, 2024 14:44
-
-
Save QuiltMeow/fbd301eba54bb393d7bbf4f08aff6033 to your computer and use it in GitHub Desktop.
KMS Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @echo off | |
| title KMS Office 2019 | |
| >nul 2>&1 "%SystemRoot%\system32\cacls.exe" "%SystemRoot%\system32\config\system" | |
| if "%ErrorLevel%" NEQ "0" ( | |
| echo 嘗試取得系統管理員權限 ... | |
| goto UACPrompt | |
| ) else ( | |
| goto getAdmin | |
| ) | |
| :UACPrompt | |
| echo set UAC = CreateObject^("Shell.Application"^) > "%Temp%\GetAdmin.vbs" | |
| echo UAC.ShellExecute "%~s0", "", "", "runAs", 1 >> "%Temp%\GetAdmin.vbs" | |
| "%Temp%\GetAdmin.vbs" | |
| exit /b | |
| :getAdmin | |
| if exist "%Temp%\GetAdmin.vbs" ( | |
| del "%Temp%\GetAdmin.vbs" | |
| ) | |
| pushd "%cd%" | |
| cd /d "%~dp0" | |
| cscript "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" /sethst:【KMS 伺服器 IP 位址】 | |
| cscript "%ProgramFiles%\Microsoft office\Office16\ospp.vbs" /setprt:1688 | |
| cscript "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" /act | |
| pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment