1.在桌面创建文本文件,命名为Hyper-V.cmd
2.将以下内容复制到创建的文本中,保存并关闭
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
3.在桌面上找到文件,右键点击,选择“以管理员身份运行”,运行后,自动打开命令行执行相关命令,执行到最后根据提示让输入Y或N,输入Y,重启电脑。
4.重启成功,Hyper-V安装完成。
安装docker时报错,需要再安装windows容器
1.创建文本文件,命名为containers.bat
2.将以下内容复制到创建的文本中,保存并关闭
pushd "%~dp0"
dir /b %SystemRoot%\servicing\Packages\*containers*.mum >containers.txt
for /f %%i in ('findstr /i . containers.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"
del containers.txt
Dism /online /enable-feature /featurename:Containers -All /LimitAccess /ALL
pause
3.在桌面上找到文件,右键点击,选择“以管理员身份运行”,运行后,自动打开命令行执行相关命令,执行到最后根据提示让输入Y或N,输入Y,重启电脑。
4.重启成功,windows容器安装完成。