Launch an application in Windows from the Ubuntu desktop
There are some limitation from the Windows guests but to run a guest application in seamless mode from a script that can be put in a launcher we tested the following procedure:
- Start VirtualBox Manager
- Log in to windows with you user and password
- Switch to seamless mode Host + L
- In seamless mode save the machine's state
Now we can get full command line control over the virtual machine with the following commands:
-
Start the virtual machine from seamless save state
VBoxManage startvm "<Name_of_VM>"
or (for the Qt frontend)
VirtualBox --startvm "<Name_of_VM>"
-
Run an application in the VM
VBoxManage --nologo guestcontrol "<Name_of_VM>" run --exe "C:\\full\\path\\to\\program.exe" --username windowsuser --password password --wait-stdout
-
Terminate VM in save state
VBoxManage controlvm "Name_of_VM" savestate
Put these in a script to enjoy seamless Windows application windows on your Ubuntu desktop.
In case you have set up a passwordless Windows logon this will not work. See in the Virtual Box Manual for limitations and how to configure Windows to get it working.
Also, to use accounts without or with an empty password, the guest's group policy must be changed. To do so, open the group policy editor on the command line by typing gpedit.msc, open the key
Computer Configuration\Windows Settings\Security Settings\Local Policies\Security Options
and change the value ofAccounts: Limit local account use of blank passwords to console logon only
to Disabled.
On operating systems without the Group Policy Editor (gpedit.msc), such as Home editions of Windows, creating a DWORD at the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\limitblankpassworduse
and setting it to zero will achieve the same effect, according to this answer.
This is more a hint than an answer, but it's too big for a comment.
You should probably look at this. According to the docs, this command, run from the host OS (I' assuming an Ubuntu host and Windows guest):
VBoxManage guestcontrol "Windows XP Pro" execute --image "cmd.exe" --username javier --verbose "/c" "regedit.exe"
Should open regedit in Windows (the guest), but I have never been able to make it work.
You can also use
VBoxManage showvminfo "Windows XP Pro" | grep State
to check if a VM is running or not.
I deleted the original idea when I realized that it won't work because Linux won't be able to access the windows partition in a VM if it's not running already. There may be a more complex way to do it, but I don't know if it's really worth it.
It may be feasible to have a common shared directory, and a script in Windows would always check this directory to see if it is empty or not. If not, it would run the scripts in the directory, which would be put there by the Ubuntu system before running the VM.
You could have a 2nd script that deletes the 1st one so it doesn't run the next time.