Created
November 20, 2022 06:20
-
-
Save Sucareto/446f1947797a8a120c7de8d76b0ad502 to your computer and use it in GitHub Desktop.
修改参数而不是添加启动项,切换启动时的 Hyper-V 状态,允许 VMware 使用嵌套虚拟化。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
pushd %~dp0 | |
%1 start "" mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c ""%~s0"" ::","","runas",1)(window.close)&&exit | |
echo "判断当前状态..." | |
bcdedit /enum {default} | find /I "hypervisorlaunchtype Auto" > nul | |
if %errorlevel% == 0 ( | |
bcdedit /set {current} HyperVisorLaunchType OFF | |
echo "Hyper-V 已关闭!" | |
) else ( | |
bcdedit /set {current} HyperVisorLaunchType Auto | |
echo "Hyper-V 已打开!" | |
) | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment