透過dir命令遍歷系統盤servicing目錄,尋找組策略的配置包,找到後寫入到gp.txt檔案,然後透過dism命令來安裝組策略包。
@echo off
pushd "%~dp0"
dir /b %systemroot%\Windows\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientExtensions-Package~3*.mum >gp.txt
dir /b %systemroot%\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientTools-Package~3*.mum >>gp.txt
for /f %%i in ("findstr /i . gp.txt 2^>nul") do dism /online /norestart /add-package:"%systemroot%\servicing\Packages\%%i"
pause
透過dir命令遍歷系統盤servicing目錄,尋找組策略的配置包,找到後寫入到gp.txt檔案,然後透過dism命令來安裝組策略包。
@echo off
pushd "%~dp0"
dir /b %systemroot%\Windows\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientExtensions-Package~3*.mum >gp.txt
dir /b %systemroot%\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientTools-Package~3*.mum >>gp.txt
for /f %%i in ("findstr /i . gp.txt 2^>nul") do dism /online /norestart /add-package:"%systemroot%\servicing\Packages\%%i"
pause