Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On a Windows machine, I need to install a virtual instance of Ubuntu Server for testing out a web application, which will eventually be rolled out to an actual web server.

I want the virtual machine to run in the background, with no graphical interfaces and website in on the server accessible from Windows.

I've been partially successful using VirtualBox. I can forward guest ports to host, that solves the website accessibility issue. But using VBoxHeadless executed from the CMD or Run left a CMD window around.

If anyone can solve the VBoxHeadless issue, that would be great. But I'm open to alternative, preferably free, software. In addition to that, a way to properly shutdown the VM would also be welcome.

share|improve this question
up vote 1 down vote accepted

Basically I am not a windows power user(I used to). I left windows way few years back. So I will not be able to help you much further.

To give you a rough idea what you need to do:

Open notepad. Create a text file named H:\test.bat and put start /b VBoxHeadless.exe --startvm vmname.

Now do the following(I have shamelessly copied it from here), but again I had mentioned this link earlier but you seem to be facing problem following it.

Then Create a VBS file (i.e., a VB Script). Open Notepad, and type the following code in it:

Set WshShell = WScript.CreateObject("WScript.Shell")
obj = WshShell.Run("H:\test.bat", 0)
set WshShell = Nothing

Replace the "H:\test.bat" in the above code with the full path of your own BAT file, but do not forget the double quotation marks around the BAT file's full path.

SAVE the file. Give it a name like HIDECMDWINDOW.VBS. The extension has to be VBS.

Double click the VBS file to run it. Your BAT file should run without showing the command window.

If your BAT file takes arguments, you can pass arguments to it too - the script for that will be a little more advanced, but if you need it, leave me a message.

Hope this will help you.

share|improve this answer
Oops, sorry, I forgot the link. And instead of creating a new answer, normally you edit your existing answer and add more stuff. (Been using Stack Exchange sites a lot, so I know their policy) – Oxwivi Nov 23 '11 at 20:07
ok thanks. But what about your problem. Is it solved? I doubt that vbscript will not work in Windows 7. – Sachin Divekar Nov 24 '11 at 5:25
To hell with BAT files, I replaced H:\test.bat with the actual VBox* commands and they worked perfectly. I didn't need start \b either. – Oxwivi Nov 25 '11 at 14:57
Of course it works. BAT file is just a series of executable commands. With BAT file you have the job you want to do. You can use it as a separate command. – Sachin Divekar Nov 25 '11 at 15:18

I think Windows start /b VBoxHeadless.exe -s vmname is what you are looking for.

/b: starts an application without opening a new Command Prompt window. Ctrl+C handling is ignored unless the application enables Ctrl+C processing. Use Ctrl+Break to interrupt the application.

share|improve this answer
Interesting. Where exactly do I use the Break key? There will be no command prompt or any related window if I start VBoxHeadless. – Oxwivi Nov 23 '11 at 10:23
Create a batch script to run the command. Then you need to create a vbscript to get rid of the window. refer this discussion. – Sachin Divekar Nov 23 '11 at 10:34
Well, I just tried it with VBoxHeadless.exe --startvm [whateverVM] /b and VBoxHeadless complained of invalid parameter. – Oxwivi Nov 23 '11 at 13:58
try start /b VBoxHeadless.exe --startvm vmname – Sachin Divekar Nov 23 '11 at 14:07
Tried it in CMD, did not work. I know nothing about Windows batch script, can you tell me how to make them? Maybe it will work as expected in scripts. – Oxwivi Nov 23 '11 at 15:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .