0

I use Virtualbox. Instead of clicking on the button of the name of the virtual machine to run it, I want a shell script that can run a Windows XP virtual machine hosted on Ubuntu machine. Can someone help me please ?

1 Answers1

0

VBox_StopRestoreStart.sh

#!/bin/bash
if [ -z "$1" ]; then
        echo "Usage: $0 VMNAME_or_UUID"
        exit 1
fi
set -x
VBoxManage controlvm  "$1" poweroff  #enforce turnoff
VBoxManage snapshot   "$1" restorecurrent   #retore state
VBoxManage showvminfo "$1" | grep State   #display state to ensure
VBoxHeadless -s       "$1"  #run in headless mode in background

source

Nymeria
  • 1,429
  • 1
  • 12
  • 19