1、新建记事本文件(.txt)
2、编辑文件内容如下
@echo off
@echo "这个批处理文件将在Windows 10家庭版上启用组策略编辑器."
pushd "%~dp0"
dir /b %SystemRoot%\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientExtensions-Package~3*.mum >List.txt
dir /b %SystemRoot%\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientTools-Package~3*.mum >>List.txt
for /f %%i in ('findstr /i . List.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"
pause
3、将文件另存为:gpedit-enabler.bat
4、使用管理员的方式运行该文件
此时win+ R“打开运行,输入gpedit.msc,可以打开组策略编辑器(gpedit.msc);
拓展:Windows 家庭版打开或关闭Hyper-V
打开hyper-v
创建open_hyper-v.bat
文件,以管理员方式执行,代码如下:
pushd "%~dp0"
dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt
for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-Package:"%SystemRoot%\servicing\Packages\%%i"
del hyper-v.txt
Dism /online /enable-feature /featurename:Microsoft-Hyper-V-All /LimitAccess /ALL
关闭hyper-v
创建close_hyper-v.bat
文件,以管理员方式执行,代码如下:
pushd "%~dp0"
dir /b %SystemRoot%\servicing\Packages*Hyper-V*.mum >hyper-v.txt
for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /Remove-Package:"%SystemRoot%\servicing\Packages\%%i"
del hyper-v.txt
Dism /online /disable-feature /featurename:Microsoft-Hyper-V-All /LimitAccess /ALL
bcdedit /set hypervisorlaunchtype off