Files
soul-yongping/macos-vm/一键启动-macOS虚拟机.bat

38 lines
1.3 KiB
Batchfile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@echo off
chcp 65001 >nul
title 一键启动 macOS 虚拟机 + TightVNC
echo ========================================
echo 一键启动 macOS 虚拟机(龙虾方案)
echo ========================================
echo.
set "VM_DIR=%USERPROFILE%\Mycontent\macos-vm\OneClick-macOS-Simple-KVM"
if not exist "%VM_DIR%\basic.sh" (
echo [错误] 未找到虚拟机目录: %VM_DIR%
echo 请先运行龙虾安装流程完成首次部署。
pause
exit /b 1
)
echo [1] 在新窗口启动 macOS 虚拟机8G 内存 / 4 核)...
start "macOS 虚拟机 - 勿关此窗口" wsl -d Ubuntu-24.04 -e bash -lc "cd /mnt/c/Users/%USERNAME%/Mycontent/macos-vm/OneClick-macOS-Simple-KVM && sudo HEADLESS=1 ./basic.sh"
echo [2] 等待约 10 秒后自动打开 TightVNC Viewer 连接 localhost:5900 ...
timeout /t 10 /nobreak >nul
set "TVN=%ProgramFiles%\TightVNC\tvnviewer.exe"
if not exist "%TVN%" set "TVN=%ProgramFiles(x86)%\TightVNC\tvnviewer.exe"
if exist "%TVN%" (
start "" "%TVN%" localhost::5900
echo [3] 已启动 TightVNC Viewer连接 localhost:5900
) else (
echo [3] 未找到 TightVNC请手动打开 VNC 客户端连接: localhost:5900
)
echo.
echo 虚拟机在「macOS 虚拟机 - 勿关此窗口」中运行,关闭该窗口会关闭虚拟机。
echo 本窗口可以关闭。
echo ========================================
pause