Scratch that. I just got it! You're a lifesaver.
You don't use --wait-for. You use --wait-exit, --wait-stdout or --wait-stderr.
I tried
Code:
VBoxManage startvm "WinXP" && VBoxManage guestcontrol WinXP exec --image c:\\program\ files\\Internet\ Explorer\\IEXPLORE.EXE --username owner --password password --wait-exit && VBoxManage controlvm "WinXP" savestate
and also tried
Code:
VBoxManage startvm "WinXP" && VBoxManage guestcontrol WinXP exec --image c:\\program\ files\\Internet\ Explorer\\IEXPLORE.EXE --username owner --password password --wait-exit && VBoxManage controlvm "WinXP" savestate
Both of those fire up the VM, launch explorer, and return to a prompt once explorer closes, but neither of them actually savestate.
My next step was to modify the original shell script and place
Code:
VBoxManage controlvm "WinXP" savestate
to it's own line. That actually did the trick. It does take about 5 seconds to shut down the VM after I close XP, but that's about the same as doing a manual savestate.
For anyone else who wants to do the same thing, the solution was fairly simple.
1. Make sure your installation of windows requires a login. This will not work with a system that is logged in automatically.
2. Shut down your VM (not just a savestate. Shut it down)
3. Boot it up, log in, switch to seemless mode, and exit saving machine state.
4. Make a script with the following somewhere in your path.
Code:
#!/bin/bash
if [ $( VBoxManage list runningvms | wc -l ) != "0" ]
then
VBoxManage guestcontrol WinXP exec --image c:\\program\ files\\Internet\ Explorer\\IEXPLORE.EXE --username owner --password password
VBoxManage controlvm "WinXP" savestate
else
VBoxManage startvm "WinXP" && VBoxManage guestcontrol WinXP exec --image c:\\program\ files\\Internet\ Explorer\\IEXPLORE.EXE --username owner --password password --wait-exit
VBoxManage controlvm "WinXP" savestate
fi
Be sure to change WinXP to the name of your virtual machine, and change the username and password accordingly. Also, don't forget to make it executable.
4. (Optional) Make a launcher for it and save to ~/.local/share/applications This will make it show up in the unity menus and allow you to put it in your quick launch bar if you're so inclined.
My launcher is just a text file called "Internet Explorer.desktop" with the following contents:
Code:
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon[en_US]=/home/stephen/Icons/1920940448.png
Name[en_US]=Internet Explorer
Exec=/home/stephen/bin/vbie.sh
Comment[en_US]=MS Internet Explorer through VirtualBox
Name=Internet Explorer
Comment=MS Internet Explorer through VirtualBox
Icon=/home/stephen/Icons/1920940448.png
Just change /home/stephen/bin/vbie.sh to the location and name of your script, and change the Icon line to the location of whatever icon you feel like downloading off the net to use. And of course, make the launcher executable as well. You'll be left with a wife-approved solution.
I'm sure the same process could be applied to just about any application that can be launched directly from an executable.
Bookmarks