本文提供Windows家庭版添加 Hyper-V、gpedit.msc 的方法。

  Windows 11家庭版 默认不包含 Hyper-V、组策略编辑器(gpedit.msc),但可以通过命令安装系统内隐藏的组策略组件来添加功能‌。


方法:

1、‌创建批处理脚本‌:在桌面新建一个文本文件,将下面的代码复制进去并保存为 xx.bat 文件

‌2、以管理员身份运行脚本‌:右键保存好的 xx.bat 文件,选择“以管理员身份运行”。命令窗口将自动安装组件,完成后按任意键关闭

代码:

一、家庭版-开启Hyper-V

@echo off
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
pause

二、家庭版-添加组策略。

@echo off
pushd "%~dp0"
dir /b %SystemRoot%\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientExtensions-Package~3*.mum >install_gpedit.txt
dir /b %SystemRoot%\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientTools-Package~3*.mum >>install_gpedit.txt
for /f %%i in ('findstr /i . install_gpedit.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"
pause