標籤

bat (54) 作品 (41) python (24) shell (17) windows (11) 虛擬機 (11) php (10) CPP (6) KMS (6) 程式設計 (6) docker (5) 使用教學 (5) xoops (4) 公文 (4) Apache2 (3) Excel (3) juniper (3) 資料庫 (3) 轉檔 (3) mysql (2) 免動手 (2) 資料結構 (2) 軟體廣播 (2) 電腦維修 (2) Android Studio (1) Apple IPAD管理 (1) Arduino (1) CSS (1) LAMP (1) NAS (1) Ubuntu (1) VHD (1) Windows Server (1) 原因 (1) 程式應用 (1) 程式積木 (1) 編輯器 (1) 雲端硬碟 (1)

2021年10月28日 星期四

只要滑鼠點兩下,讓電腦開機自動完成彰化縣Office 與Windows KMS 雙認證

   系列文章:

          由於彰化縣KMS將於2021年11月1日停止服務,資訊組就人仰馬翻要去處理電腦Windows與Office認證。希望能夠只要滑鼠點兩下,讓電腦開機時就完成Windows與Office雙認證,不需要資訊組再去處理。那如果想要電腦開機時就完成Windows與Office雙認證,也只要點兩下就好。

範例檔案下載,解壓密碼demo1234

教學影片


        此外,針對縣網版本Office認證BAT,進行比對。發現chcoffice2016_kms.bat 與 chcoffice2019_kms.bat 的內容 只有6與9的差別。換言之,office2019的認證可以用chcoffice2016_kms.bat 進行認證。

目的:電腦開機自動完成彰化縣Office 與Windows KMS 雙認證
檔案名稱:AutoChcDoubleCerti.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

REM -------------------關閉UAC------------------------
rem reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "EnableLUA" /d 0 /t REG_DWORD /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "ConsentPromptBehaviorAdmin" /d 0 /t REG_DWORD /f
gpupdate /force
taskkill /f /im explorer.exe
start %systemroot%\explorer

REM -------------------將縣網Win10認證複製到Startup------------------------
copy "%~dp0\KMS\chcwin10_kms.bat" "%HomePath%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"

REM -------------------暫停2秒------------------------
timeout /t 2 /nobreak

REM -------------------判別Office版本------------------------
for /l %%a in (8,1,16) do (
for /f "tokens=*" %%i in ('reg query "HKEY_CURRENT_USER\Software\Microsoft\Office\%%a.0\Word\Options" /v "PROGRAMDIR"') do (if not "%%i"=="" set Ever=%%a))
cls&echo %Ever%
echo %Ever%
if %Ever%==14 (goto office2010)
if %Ever%==15 (goto office2013)
if %Ever%==16 (goto office2016)

:office2010
copy "%~dp0\KMS\chcoffice2010_kms.bat" "%HomePath%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
shutdown /r /f /t 0
exit

:office2013
copy "%~dp0\KMS\chcoffice2013_kms.bat" "%HomePath%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
shutdown /r /f /t 0
exit

:office2016
copy "%~dp0\KMS\chcoffice2016_kms.bat" "%HomePath%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
shutdown /r /f /t 0
exit

目的:移除電腦開機自動完成彰化縣Office 與Windows KMS 雙認證
檔案名稱:RemoveAutoChcDoubleCerti.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

REM -------------------開啟UAC------------------------
rem reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "EnableLUA" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "ConsentPromptBehaviorAdmin" /d 5 /t REG_DWORD /f
gpupdate /force
taskkill /f /im explorer.exe
start %systemroot%\explorer

REM -------------------刪除Startup縣網Win10認證------------------------
del "%HomePath%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\chcwin10_kms.bat"

REM -------------------刪除Startup縣網Office認證------------------------

REM -------------------判別Office版本------------------------
for /l %%a in (8,1,16) do (
for /f "tokens=*" %%i in ('reg query "HKEY_CURRENT_USER\Software\Microsoft\Office\%%a.0\Word\Options" /v "PROGRAMDIR"') do (if not "%%i"=="" set Ever=%%a))
cls&echo %Ever%
echo %Ever%
if %Ever%==14 (goto office2010)
if %Ever%==15 (goto office2013)
if %Ever%==16 (goto office2016)

:office2010
del "%HomePath%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\chcoffice2010_kms.bat"
shutdown /r /f /t 0
exit

:office2013
del "%HomePath%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\chcoffice2013_kms.bat"
shutdown /r /f /t 0
exit

:office2016
del "%HomePath%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\chcoffice2016_kms.bat"
shutdown /r /f /t 0
exit

資料來源:

只要滑鼠點兩下,讓電腦開機自動判別Office版本並進行彰化縣Office KMS 認證

 系列文章:

          由於彰化縣KMS將於2021年11月1日停止服務,資訊組就人仰馬翻要去處理電腦Windows與Office認證。希望能夠只要滑鼠點兩下,讓電腦開機時就完成Office KMS認證,不需要資訊組再去處理。那如果不想要電腦開機時就完成Office KMS認證,也只要點兩下就好。

範例檔案下載,解壓密碼demo1234

使用教學影片:



        此外,針對縣網版本Office認證BAT,進行比對。發現chcoffice2016_kms.bat 與 chcoffice2019_kms.bat 的內容 只有6與9的差別。換言之,office2019的認證可以用chcoffice2016_kms.bat 進行認證。

目的:電腦開機自動判別Office版本並進行彰化縣Office KMS 認證
檔案名稱:AutoChcOfficeVerCerti.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

REM -------------------關閉UAC------------------------
rem reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "EnableLUA" /d 0 /t REG_DWORD /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "ConsentPromptBehaviorAdmin" /d 0 /t REG_DWORD /f
gpupdate /force
taskkill /f /im explorer.exe
start %systemroot%\explorer

REM -------------------判別Office版本------------------------
for /l %%a in (8,1,16) do (
for /f "tokens=*" %%i in ('reg query "HKEY_CURRENT_USER\Software\Microsoft\Office\%%a.0\Word\Options" /v "PROGRAMDIR"') do (if not "%%i"=="" set Ever=%%a))
cls&echo %Ever%
echo %Ever%
if %Ever%==14 (goto office2010)
if %Ever%==15 (goto office2013)
if %Ever%==16 (goto office2016)

:office2010
copy "%~dp0\KMS\chcoffice2010_kms.bat" "%HomePath%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
shutdown /r /f /t 0
exit

:office2013
copy "%~dp0\KMS\chcoffice2010_kms.bat" "%HomePath%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
shutdown /r /f /t 0
exit

:office2016
copy "%~dp0\KMS\chcoffice2010_kms.bat" "%HomePath%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
shutdown /r /f /t 0
exit

目的:移除電腦開機自動判別Office版本並進行彰化縣Office KMS 認證
檔案名稱:RemoveAutoChcOfficeVerCerti.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

REM -------------------開啟UAC------------------------
rem reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "EnableLUA" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "ConsentPromptBehaviorAdmin" /d 5 /t REG_DWORD /f
gpupdate /force
taskkill /f /im explorer.exe
start %systemroot%\explorer

REM -------------------刪除Startup縣網Office認證------------------------

REM -------------------判別Office版本------------------------
for /l %%a in (8,1,16) do (
for /f "tokens=*" %%i in ('reg query "HKEY_CURRENT_USER\Software\Microsoft\Office\%%a.0\Word\Options" /v "PROGRAMDIR"') do (if not "%%i"=="" set Ever=%%a))
cls&echo %Ever%
echo %Ever%
if %Ever%==14 (goto office2010)
if %Ever%==15 (goto office2013)
if %Ever%==16 (goto office2016)

:office2010
del "%HomePath%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\chcoffice2010_kms.bat"
shutdown /r /f /t 0
exit

:office2013
del "%HomePath%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\chcoffice2010_kms.bat"
shutdown /r /f /t 0
exit

:office2016
del "%HomePath%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\chcoffice2010_kms.bat"
shutdown /r /f /t 0
exit

2.


只要滑鼠點兩下,讓BAT自動判別Office版本進行彰化縣Office KMS 認證

          由於彰化縣KMS將於2021年11月1日停止服務,資訊組就人仰馬翻要去處理電腦Windows與Office認證。要叫老師判斷自己電腦Office 版本,然後進行認證。想到這個就頭大。可不可簡單一點,讓老師直接對BAT點兩下,就能完成Office的認證。

範例檔案下載,解壓密碼demo1234

使用教學影片:



此外,針對縣網版本Office認證BAT,進行比對。發現chcoffice2016_kms.bat 與 chcoffice2019_kms.bat 的內容 只有6與9的差別。換言之,office2019的認證可以用chcoffice2016_kms.bat 進行認證。

目的:BAT自動判別Office版本進行彰化縣Office KMS 認證
檔案名稱:AutoOfficeCerti.bat
內容:
@echo off
for /l %%a in (8,1,16) do (
for /f "tokens=*" %%i in ('reg query "HKEY_CURRENT_USER\Software\Microsoft\Office\%%a.0\Word\Options" /v "PROGRAMDIR"') do (if not "%%i"=="" set Ever=%%a))
cls&echo %Ever%
echo %Ever%
if %Ever%==14 (goto office2010)
if %Ever%==15 (goto office2013)
if %Ever%==16 (goto office2016)

:office2010
%~dp0\KMS\chcoffice2010_kms.bat
pause
exit

:office2013
%~dp0\KMS\chcoffice2013_kms.bat
pause
exit

:office2016
%~dp0\KMS\chcoffice2016_kms.bat
pause
exit

資料來源:

只要滑鼠點兩下,讓電腦開機自動完成彰化縣Windows KMS認證


        由於彰化縣KMS將於2021年11月1日停止服務,資訊組就人仰馬翻要去處理電腦Windows與Office認證。希望能夠只要滑鼠點兩下,讓電腦開機時就完成認證,不需要資訊組再去處理。那如果不想要電腦開機時就完成認證,也只要點兩下就好。

範例檔案下載,解壓密碼demo1234

使用教學影片:



目的:電腦開機自動完成彰化縣Windows KMS認證
檔案名稱:AutoChcWin10Certi.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

REM -------------------關閉UAC------------------------
rem reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "EnableLUA" /d 0 /t REG_DWORD /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "ConsentPromptBehaviorAdmin" /d 0 /t REG_DWORD /f
gpupdate /force
taskkill /f /im explorer.exe
start %systemroot%\explorer

REM -------------------將縣網Win10認證複製到Startup------------------------
copy "%~dp0\KMS\chcwin10_kms.bat" "%HomePath%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
shutdown /r /f /t 0

目的:移除電腦開機自動完成彰化縣Windows KMS認證
檔案名稱:RemoveAutoChcWin10Certi.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

REM -------------------開啟UAC------------------------
rem reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "EnableLUA" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "ConsentPromptBehaviorAdmin" /d 5 /t REG_DWORD /f
gpupdate /force
taskkill /f /im explorer.exe
start %systemroot%\explorer

REM -------------------刪除Startup縣網Win10認證------------------------
del "%HomePath%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\chcwin10_kms.bat"
shutdown /r /f /t 0


只要滑鼠點兩下,就可以完成彰化縣網中心Windows與office認證


         由於彰化縣KMS將於2021年11月1日停止服務,資訊組就人仰馬翻要去處理電腦Windows與Office認證。然後老師就會一直來問怎麼做認證。依據KMS認證,需要對BAT按滑鼠右鍵,以系統管理員身分執行。又怕老師來問如何對BAT按滑鼠右鍵,以系統管理員身分執行。乾脆就改寫彰化縣網中心Windows與office認證BAT。讓老師只要用滑鼠點兩下就可以完成認證。

範例檔案下載,解壓密碼demo1234

使用教學影片:



目的:完成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. & pause

目的:完成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. & pause

目的:完成Office2010 認證
檔案名稱:chcoffice2010_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 偵測 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 啟動成功!
pause

目的:完成Office2013 認證
檔案名稱:chcoffice2013_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 偵測 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 啟動成功!
pause

目的:完成Office2016 認證
檔案名稱:chcoffice2016_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 偵測 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 啟動成功!
pause

目的:完成Office2019 認證
檔案名稱:chcoffice2019_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 偵測 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 啟動成功!
pause

資料來源:

只要點兩下,就能夠將InputAndOutput資料夾底下的子子孫孫資料夾內所有Word通通轉成PDF

  系列文章: 1. 只要點兩下,就能將一堆的Doc與Docx 轉成 PDF 1. https://skjhcreator.blogspot.com/2023/05/docdocx-pdf.html 2. 只要點兩下,就能將一堆的JPG轉成一個PDF,並以JPG所在的資料夾名稱為...