VMWare wrapper script for fullscreen startup (Windows)

25.07.2005 at 18:34

I found a batch script on my pc at work which i had written last year. It might be useful for someone who wants to start a VMware-Virtual-Machine directly in fullscreen mode with a simple shortcut. It is tested on WinXP with VMWare 4.5 but should also work with Win2000. Anyway here is the code:

:: 
:: Script: 	vmware.start.bat
::
:: Description:	This automatically starts the
:: 		requested virtual machine in
:: 		fullscreen mode.
:: 
:: More infos:	are here available
::
:: Last Update:	12-10-2004
::		

@echo off

:: The following variable should point to 
:: your installation directory of VMWare

SET VM_DIR=C:\Programme\VMware\VMware Workstation\

:: The follwing variable should point to 
:: your virtual-machine-file (*.wmx)

SET VM_FILE=%1%

IF '%VM_FILE%' == '' (
	echo Usage vmware.bat [vmx-file]
	goto end
)

IF NOT EXIST %VM_FILE% (
	echo vmx-file doesn't exists.
	goto end
)

echo Switching to VM-Ware directory....

cd %VM_DIR%

echo Try to start VM...................

start vmware-fullscreen.exe -poweron -fullscreen -name=VM %VM_FILE%

IF %ERRORLEVEL% GTR 0 (
	echo couldn't start vmware.
	goto end
)

echo VM is runing......................

::
:: ok the virtual machine is started
:: now we provide a little console
::

echo You are now in command mode, type "help" for a list of supported commands

:console

set /P command=

if "%command%" == "quit" (
	vmware-fullscreen.exe -poweroff VM
	exit
) else if "%command%" == "switch" (
	vmware-fullscreen.exe -switchto VM
) else if "%command%" == "clear" (
	cls;
) else if "%command%" == "help" (
	echo Supported commands
	echo   quit     shutdown the virtual machine and close this window
	echo   switch   switch to the virtual machine
	echo   clear    clear the screen
	echo   help     diplay this message
) else (
	echo Syntax error type "help" for a list of supported commands
)

goto console

:end

The script first invokes the virtual machine and then provides a little console for controlling it further. The script expects the vmware-config file as command line argument, here is an example:

vwmare.start.bat "D:\My Virtual Machines\Debian\Debian.vmx"

I have also set up a config file to easily switch between the vm and the host operating system via hotkeys. It should be placed under "C:\Documents and Settings\All Users\Application Data\VMware\VMware Workstation\config.ini".

prefvmx.useRecommendedLockedMemSize = "TRUE"
priority.grabbed = "normal"
priority.ungrabbed = "normal"
fullScreenSwitch.cycleKey = "0x09,0x3"
FullScreenSwitch.hostDirectKey = "0x1B,0x3"
FullScreenSwitch.cycleHost = "TRUE"

This allows us to circle between the vm and the host with: CTRL + ALT + TAB. With CTRL + ALT + ESC we are back to the host. And with CTRL + F1 we can switch back to the virtual machine. See this page for further information.

Comments (0)

There are currently no comments available