Last active
August 29, 2015 14:10
-
-
Save seak0503/9fed060cd977de8417fa to your computer and use it in GitHub Desktop.
windows7上のvirtualboxの仮想サーバを制御するスクリプト
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
/* | |
windows7上のVirtualBoxの仮想サーバを起動するスクリプトです。 | |
guest_os_name の部分を書き換えて使用してください。 | |
*/ | |
var WshShell = new ActiveXObject("WScript.Shell"); | |
// Runの最後の引数にfalseを与えることで、waitせずにホストに制御を戻しています。 | |
WshShell.Run("\"C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe\" startvm \"guest_os_name\"", 0, false); | |
WshShell = null; |
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
/* | |
windows7上のVirtualBoxの仮想サーバを停止するスクリプトです。 | |
guest_os_name の部分を書き換えて使用してください。 | |
注意事項: ゲストのACPIによる自動シャットダウン可能にしておく必要があります。 | |
*/ | |
var WshShell = new ActiveXObject("WScript.Shell"); | |
// Runの最後の引数をtrueにすることで、シャットダウン終了までスクリプト終了をwaitさせることができます。 | |
WshShell.Run("\"C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe\" controlvm \"guest_os_name\" acpipowerbutton", 0, true); | |
WshShell = null; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment