最近win10升级到了win11后,发现没有Hyer-v(因为我需要在windows上安装docker,windows wsl,然后需要开启Hyper-v功能)
image.png
解决方案如下:
1、新建txt文档,并重命名为Hyper-V.cmd,然后将如下脚本内容添加进文档中
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
2、右键管理员打开Hyper-V.cmd文件
3、系统执行脚本内容安装好后,会弹出电脑自动重启,电脑重启后,就能看到Hyper-v已经勾选上了。
image.png