Created
July 30, 2019 06:42
-
-
Save leetking/0582136b3e5a4f05435373d6e87722b8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
:: 使用 ssh 连接到虚拟机内的 ArchLinux 系统 | |
@echo off | |
: archlinux 是 .ssh/config 里为虚拟机设置的别名 | |
set vm=ArchLinux | |
if "%1" == "stop" ( | |
echo Save state of %vm% ... | |
VBoxManage controlvm %vm% savestate | |
goto QUIT | |
) else if "%1" == "status" ( | |
VBoxManage list runningvms | findstr %vm% | |
if errorlevel 1 ( | |
echo vm %vm% stoped | |
) | |
goto QUIT | |
) | |
VBoxManage list runningvms | findstr %vm% 1> nul 2> nul | |
if errorlevel 1 ( | |
echo Starting %vm% ... | |
VBoxManage startvm %vm% --type headless | |
) | |
if "%1" == "start" ( | |
goto QUIT | |
) | |
: 默认连接到虚拟机 | |
ssh archlinux | |
:QUIT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment