在Windows11家庭版上开启Hyper-V虚拟机套件

新建一个文本文档,将一下代码复制进文件中

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

然后将文件后缀.txt改为.bat,然后右键以管理员身份运行脚本,然后默默等待脚本运行结束,最后的提示输入Y即可完成安装