Can I create shortcut on my desktop for a virtual machine?

Discussions related to using VirtualBox on Windows hosts.

Can I create shortcut on my desktop for a virtual machine?

Postby tao0407 » 7. Dec 2009, 04:27

As tilte shown. :)
tao0407
 
Posts: 12
Joined: 26. Feb 2009, 10:48

Re: Can I create shortcut on my desktop for a virtual machine?

Postby Perryg » 7. Dec 2009, 06:02

Create a batch file (CMD for NT and up) with the following in the same directory that the rest of the virtualbox files are in, then add it as a shortcut to the desktop.
Code: Select all   Expand viewCollapse view
@echo off
cls
start virtualbox.exe --startvm Ubuntu-Karmic
@exit

Substitute the (Ubuntu-Karmic) with the actual name of the VM. If it contains spaces then use "" Example:("Ubuntu Karmic")
Perryg
Site Moderator
 
Posts: 25959
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX - Other

Re: Can I create shortcut on my desktop for a virtual machine?

Postby abcuser » 7. Dec 2009, 12:10

Hi,
I use the following script:
Code: Select all   Expand viewCollapse view
@echo off
cd "C:\Program Files\Sun\VirtualBox"
VBoxManage startvm "Ubuntu 9.10 Desktop"

Note: "Ubuntu 9.10 Desktop" is my virtual machine name.
Regards
abcuser
Volunteer
 
Posts: 543
Joined: 10. May 2007, 20:03
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Ubuntu, Windows XP

Re: Can I create shortcut on my desktop for a virtual machine?

Postby dineshj » 7. Dec 2009, 14:56

if you are looking for a solution in Windows environment, try the steps in this site http://virtualization.sysprobs.com/create-shortcut-virtual-machine-virtualbox
dineshj
 
Posts: 34
Joined: 21. Nov 2009, 07:48
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Windows Vista

Re: Can I create shortcut on my desktop for a virtual machine?

Postby tao0407 » 9. Dec 2009, 03:16

Thank you all very much!
tao0407
 
Posts: 12
Joined: 26. Feb 2009, 10:48

Re: Can I create shortcut on my desktop for a virtual machine?

Postby MarkCranness » 9. Dec 2009, 07:05

Two notes:

- VirtualBox.exe --startvm "<VMName>" is the preferred way to start a VM, rather than use the VBoxManage command.

- If the VM name contains embedded space characters, then put double-quotes around it.

Tell me what VirtualBox version you are using and what OS your VM uses and I'll build a free shortcut icon for you!
MarkCranness
Volunteer
 
Posts: 875
Joined: 10. Oct 2009, 06:27
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Windows Server 2008 R2; Ubuntu 11.04; Windows 2000 Server; Windows XP

Re: Can I create shortcut on my desktop for a virtual machine?

Postby abcuser » 9. Dec 2009, 08:51

MarkCranness wrote:- VirtualBox.exe --startvm "<VMName>" is the preferred way to start a VM, rather than use the VBoxManage command.

I have never had any problems and I always use VBoxManage. Why is virtualbox command prefered way?
abcuser
Volunteer
 
Posts: 543
Joined: 10. May 2007, 20:03
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Ubuntu, Windows XP

Re: Can I create shortcut on my desktop for a virtual machine?

Postby MarkCranness » 9. Dec 2009, 12:36

VBoxManage --type GUI just calls VirtualBox.exe --startvm anyway, so you are cutting out some processing.

VBoxManage is a command line program, and so opens a command window for a short period while VirtualBox.exe runs and starts. That window is the reason for the '@echo off; cls; @exit' rhubarb whenever anyone suggests a BAT/CMD file to run a VM, which is not needed if calling VirtualBox.exe directly.
MarkCranness
Volunteer
 
Posts: 875
Joined: 10. Oct 2009, 06:27
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Windows Server 2008 R2; Ubuntu 11.04; Windows 2000 Server; Windows XP

Re: Can I create shortcut on my desktop for a virtual machine?

Postby mpack » 9. Dec 2009, 12:55

MarkCranness wrote:VBoxManage --type GUI just calls VirtualBox.exe --startvm anyway, so you are cutting out some processing.

That doesn't sound right to me. VirtualBox.exe is just a GUI front end for VBoxSVC, as VBoxManage is a CLI front end for it. I can't imagine why VBoxManage would call on the services of VirtualBox.exe - unless of course the "requested service" is a GUI.
mpack
Site Moderator
 
Posts: 13194
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Can I create shortcut on my desktop for a virtual machine?

Postby MarkCranness » 10. Dec 2009, 01:29

VBoxManage gets VBoxSVC to open a new 'session' for the VM, and VBoxSVC runs VirtualBox.exe --startvm in response.

Too much detail!:
VBoxManage handles the startvm command using internal function handleStartVM:
http://www.virtualbox.org/browser/trunk ... 25275#L365

handleStartVM calls VirtualBox::OpenRemoteSession with the required session --type (default=gui):
http://www.virtualbox.org/browser/trunk ... 25275#L378

VirtualBox::OpenRemoteSession calls Machine::openRemoteSession (I think this is now running in VBoxSvc?):
http://www.virtualbox.org/browser/trunk ... 5275#L1843

Machine::openRemoteSession creates a command line with VirtualBox.exe and parameter --startvm:
http://www.virtualbox.org/browser/trunk ... 5275#L4669

Machine::openRemoteSession creates a new process with the given command line:
http://www.virtualbox.org/browser/trunk ... 5275#L4681
MarkCranness
Volunteer
 
Posts: 875
Joined: 10. Oct 2009, 06:27
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Windows Server 2008 R2; Ubuntu 11.04; Windows 2000 Server; Windows XP

Re: Can I create shortcut on my desktop for a virtual machine?

Postby mpack » 10. Dec 2009, 11:53

It still looks odd to me: have you enabled the remote display feature for this VM? I'm wondering what else a "remote session" might mean.

Bear in mind that the VirtualBox.exe process on the host can be closed once a VM is running, so it simply cannot be responsible for controlling any important service required by a running VM, at most it only starts those services, which are presumably controlled by VBoxSVC. VBoxManage could presumably start those services too, which is why I find it odd that VBoxManage needs the GUI for anything.
mpack
Site Moderator
 
Posts: 13194
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Can I create shortcut on my desktop for a virtual machine?

Postby Perryg » 10. Dec 2009, 16:33

In Windows only.
VirtualBox.exe is the GUI frontend and VBoxManage.exe is the CLI frontend.
Either one can start the VM. The problem is if you call the startvm from a command window and want the command window to go away without killing the VM you had to use VirtualBox.exe and run it as a batch statement. Now this may have changed which could be causing this confusion, but that is the way it used to be.
Perryg
Site Moderator
 
Posts: 25959
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX - Other

Re: Can I create shortcut on my desktop for a virtual machine?

Postby mpack » 10. Dec 2009, 17:05

Perryg wrote:VirtualBox.exe is the GUI frontend and VBoxManage.exe is the CLI frontend.
Either one can start the VM. The problem is if you call the startvm from a command window and want the command window to go away without killing the VM you had to use VirtualBox.exe and run it as a batch statement.

Since both VirtualBox.exe and VBoxManage.exe are just front ends for VBoxSVC, and since VBoxSVC runs independantly of the command prompt, I would expect to be able to kick off a VM using "VBoxManage startvm x", and be able to close the command prompt window after the VM starts...

...and in fact I just tried it, and it did exactly what I expected it to (the command window closed when I typed "exit", the VM continued running). This experiment was done at work, where I'm still running VBox 3.0.8.


And for my next trick I tried doing exactly the same thing again, but this time I renamed "VirtualBox.exe" to prevent VBoxManage.exe from being able to find it. This time, and contrary to my expectations, the VM failed to start: I got an error message relating to the OpenRemoteSession() API that Mark mentioned a few messages back.
mpack
Site Moderator
 
Posts: 13194
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Can I create shortcut on my desktop for a virtual machine?

Postby Perryg » 10. Dec 2009, 17:18

That is what I expected to happen. I do not know when the actual condition changed but back in the V2.x days the command window had to stay open if you started it from CLI using VBoxManage.exe and if you closed it (the command window) the vm would also shutdown and show as aborted. I am sure things have changed drastically since then but since the old structure still works I use what I have been using.
Perryg
Site Moderator
 
Posts: 25959
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX - Other

Re: Can I create shortcut on my desktop for a virtual machine?

Postby MarkCranness » 11. Dec 2009, 02:35

VirtualBox::OpenRemoteSession is what is always called: it's not dependent upon startup type or anything, I suppose that's just what Innotech decided to name the function.

If you look in Task Manager (or better yet Sysinternals Process Explorer) you will see one VirtualBox.exe for the GUI (if it is still open) and one for each running VM. Process Explorer even shows them running as child processes of VBoxSVC (because they were launched from VBoxSVC).

So I'm sure that VirtualBox.exe has two functions / does double duty:
1) The GUI we see,
2) A host window for a running VM.
MarkCranness
Volunteer
 
Posts: 875
Joined: 10. Oct 2009, 06:27
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Windows Server 2008 R2; Ubuntu 11.04; Windows 2000 Server; Windows XP

Next

Return to VirtualBox on Windows Hosts

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], mpack, Supuhstar and 58 guests