Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Refer to : Launch an application in Windows from the Ubuntu desktop

I was wondering if Takkat could elaborate on the actual execution i.e. howto in the script file.

This will be greatly helpful. Thanks in advance

my script file InternetExplorerVM.sh looks like this, execution is

/path/to/InternetExplorerVM.sh "C:\Program Files\Internet Explorer\iexplore.exe"

#!/bin/bash

# start Internet Explorer inside of a Windows7 Ultimate VM
echo "Starting 'Internet Explorer' browser inside Windows7 virtual machine"
echo ""
sleep 1
echo "Please be patient"

VBoxManage startvm b307622e-6b5e-4e47-a427-84760cf2312b

sleep 15

echo ""
echo "Now starting 'Internet Explorer'"
##VBoxManage --nologo guestcontrol b307622e-6b5e-4e47-a427-84760cf2312b execute --image "$1" --username RailroadGuest --password bnsf1234

VBoxManage --nologo guestcontrol b307622e-6b5e-4e47-a427-84760cf2312b execute --image "C:\\Program/ Files\\Internet/ Explorer\\iexplore.exe" --username RailroadGuest --password bnsf1234 --wait-exit --wait-stdout

echo ""
echo "Saving the VM's state now"
VBoxManage controlvm b307622e-6b5e-4e47-a427-84760cf2312b savestate

sleep 2

#Check VM state
echo ""
echo "Check the VM state"
VBoxManage showvminfo b307622e-6b5e-4e47-a427-84760cf2312b | grep State

exit

My apologies for any mistakes, this is my first time posting on askubuntu.Thanks a ton in advance. This has been very helpful. Need this for BNSF guests, their Mainframe emulator works exclusively on Java enabled Internet Explorer.

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

He's basically saying you can do this:

  1. Create a Virtual Machine, like a Windows virtual machine.
  2. Login to the virtual machine.
  3. Switch the virtual machine into "seamless" mode
  4. Save the state of the virtual machine in the main Virtual Box window.
  5. Create a bash script with the VBoxManage commands, so that you can do something like ./runinwindows "C:\\some\\path\\executable.exe"

For example:

#!/bin/bash
# Start the VM
VBoxManage startvm "<Name_of_VM>"

# Run the executable
VBoxManage --nologo guestcontrol "<Name_of_VM>" execute --image "$1" --username windowsuser --password password --wait-exit --wait-stdout

# Save the current machine state for the next time you run the script.
VBoxManage controlvm "Name_of_VM" savestate

Then you could run a Windows executable (in this case) in your terminal, but it would actually be running in a virtual machine.

share|improve this answer
    
My script file to start Internet Explorer, looks like this VBoxManage --nologo guestcontrol b307622e-6b5e-4e47-a427-84760cf2312b execute --image "C:\Program Files\Internet Explorer\iexplore.exe" --username username --password password was wondering what the "savestate" for. –  TheWickerman666 Oct 1 '12 at 7:47
    
Did this answer your question? If so, you should mark this as the answer. –  Sly Oct 1 '12 at 7:53
1  
@TheWickerman666: savestate is like "hibernating" your VM. –  Takkat Oct 1 '12 at 8:06
    
Thanks Takkat, but why do we need it, when we want the program to run, is it that it will wait for th program to execute and then close virtualbox VM in savestate mode. –  TheWickerman666 Oct 1 '12 at 8:12
    
now my script file looks like this: –  TheWickerman666 Oct 1 '12 at 8:13
show 3 more comments

I wrote a script to control a virtual machine using VBoxManage You can find here My blog
you can execute commande using the script like this
./vmcontrol.sh -m [VMName] [Your Command]

share|improve this answer
    
You should copy-paste you script here. Stackoverflow answers try to be self-contained, in order to avoid readers having to click through links to get their answer (when the link's not dead of course). Also, I don't think the backslah before $ is needed, i.e. write $foo instead of \$foo –  Georges Dupéron Oct 4 '13 at 19:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.