Skip to content

Instantly share code, notes, and snippets.

@xnrghzjh
Created June 15, 2011 00:34
Show Gist options
  • Save xnrghzjh/1026262 to your computer and use it in GitHub Desktop.
Save xnrghzjh/1026262 to your computer and use it in GitHub Desktop.
VirtualBoxの仮想マシンを非表示で管理(wsfから移植)
import javax.swing.*;
// VirtualBoxのパス
path = "C:\\Program Files\\Oracle\\VirtualBox\\"
// 仮想マシンのリスト
list = ['RedMine', 'DokuWiki']
// 引数チェック
if (args.size() == 0) {
JOptionPane.showMessageDialog(null, "引数を指定してください\n 起動:On 停止:Off", "起動エラー", JOptionPane.ERROR_MESSAGE)
return
}
switch (args[0]) {
case "On":
list.each { "${path}VBoxHeadless.exe -s ${it}".execute() }
break;
case "Off":
list.each { "${path}VBoxManage.exe controlvm ${it} acpipowerbutton".execute() }
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment