[Introduction] [Details] [Build Notes]
NOTE: Most functions of these programs are now covered by "vmw.exe" for Windows and "vmw.com", "vmtsr.com" for DOS (http://chitchat.at.infoseek.co.jp/vmware/vmtools.html). Also some of these programs may not work or may behave differently on recent VMware products, since they were developed on VMware Workstation 3.x and have not been updated afterwards.
VMware Command Line Tools is a set of several small and simple command line programs for DOS and Windows to use VMware's undocumented "backdoor" functions. It consists of the following programs:
| name | description |
|---|---|
| vmchk | Checks if it is running inside VMware. |
| vmdev | Connects and disconnects connectable virtual devices, such as floppy, CD, sound and NIC. |
| vmpref | Enables and disables VMware GUI preference settings, such as copy & paste and time synchronization. |
| vmtime | Synchronizes guest's system time with host's system time. Note that this is just a regular "one shot" program and you have to run it periodically to keep guest and host in sync for a long period of time. |
| vmcopy | Copies text data from guest to host's clipboard. Since DOS doesn't have any built-in clipboard, it reads text from standard input. |
| vmscr | Like vmcopy, this program copies text data from guest to host
but it reads text from screen instead of standard input. In short, you can take a "screen shot" of DOS guest. |
| vmpaste | Pastes text data from host's clipboard to guest. Since DOS doesn't have any built-in clipboard, it writes text to standard output. |
| vmpop | Well, it's a kind of joke... |
Checks if it is running inside VMware and output the result to standard output. Also returns the result as return status (ERRORLEVEL) so you can use it in DOS batch files. If you don't want it to print to screen (for example, when using in a batch file), simply redirect the output to NUL device.
When outside VMware (i.e. in real machine), return status is 0.
When inside VMware, return status is "version number"
returned by VMware.
What this "version number " means is anyone's guess.
Options:
None.
Examples:
When outside VM
C:\>vmchk
Not running inside VMware.
When inside VM
C:\>vmchk
Running inside VMware (version 6).
A batch file example
@echo off
vmchk > NUL
if errorlevel 1 goto inside
echo Not in VM!
...
:inside
echo Inside VM!
...
Connects and disconnects devices. Also prints current device state to standard output.
Options:
vmdev [<action>][<device>]
| <action> | |
| + | Connect target device(s). This is the default. When the target device is already connected, this option causes it to be disconnected and reconnected. (Well, I'm a bit proud of this feature. It's convenient. Honest!) |
| - | Disconnect target device(s). |
| <device> | |
| 0..9 | Target device number to connect / disconnect. |
| * | Represents all devices present. This is the default. |
When both <action> and <device> options are omitted, it only shows current device state list. Connected devices are marked with '+' in the list.
Examples:
To print current device state list:
vmdevTo connect (or reconnect) all devices:
vmdev * or vmdev +* or vmdev +Likewise, to disconnect all devices:
vmdev -* or vmdev -To connect (or reconnect) device number 2:
vmdev 2 or vmdev +2To disconnect device number 1.
vmdev -1
Enables and disables following preference settings. Also prints current setting list to standard output.
Options:
vmpref [[<action>]<feature>]
| <action> | |
| + | Enables specified feature. |
| - | Disables specified feature. |
| When <action> option is omitted, the default action is to 'toggle' current setting. | |
| <feature> | |
| G | Grab when cursor enters window. |
| U | Ungrab when cursor leaves window. |
| S | Scroll when cursor approaches window edge. |
| C | Copy and paste between host and guest. |
| T | Time synchronization between host and guest. |
<feature> options are case insensitive. When <feature> options is omitted, it only shows current preference setting list.
Examples:
To print current preference setting:
vmpref or vmpref + or vmpref -To toggle 'copy and paste' feature:
vmpref cTo enable 'time synchronization' feature:
vmdev +tTo disable 'ungrab' feature:
vmdev -u
Synchronizes guest's clock to host's clock, when executed. Also prints updated current time to standard output. It is not capable of running background so you have to run it periodically to have host and guest in sync for a long period of time. Consider using vmw.exe for Windows guest and vmtsr.com for DOS guest for that purpose.
Options:
None
Reads text data from standard input and copy it to host's clipboard.
Although both versions read text from standard input, DOS16 version does not
accept keyboard input (actually it does, but it never waits for input so
unless you can type very fast it quits before you type anything).
This program is intended to be used with pipe and/or redirection.
WIN32 version can send maximum of 65,355 bytes, which I believe to be a limitation imposed by VMware. DOS16 version can handle slightly less, somewhere around 65,000 bytes.
Just like official VMware-Tools, only text data can be transferred. This is, as it turned out, because VMware performs LF - CR/LF conversion unconditionally.
For this program to work, VMware's copy & paste feature must be
enabled. VMware simply doesn't pass any data when it is disabled.
And here's a catch. When you use this (either DOS16 or WIN32 version)
in Windows guest with official VMware-Tools running, you must disable
the copy & paste feature after you sent data to host.
Otherwise official VMware-Tools overwrites host's clipboard when you release
cursor from guest (with text stored in guest's clipboard), so you can never
retrieve the text you sent from guest.
You can automate it with a simple batch file, if you like:
@echo off
REM ensure that copy & paste is enabled
vmpref +c
REM copy data from stdin
vmcopy
REM now disable copy & paste
vmpref -c
Options:
None.
Examples:
To copy text from a file:
vmcopy < somefile.txtTo copy result of a command:
dir | vmcopy
Reads text data from screen and copy it to host's clipboard.
There is no WIN32 version because it would be just plain useless.
Use official VMware-Tools instead.
NOTE: vmtsr.com for DOS now provides the same function with a hot key combination support (you can take snapshot almost any time).
In the same way as vmcopy, this program needs
that VMware's copy & paste feature enabled because
VMware doesn't pass any data when it is disabled.
And be careful when you use it in Windows guest with official VMware-Tools
running, you must disable the copy & paste feature after you
sent data to host.
Otherwise official VMware-Tools overwrites host's clipboard when you release
cursor from guest (with text stored in guest's clipboard), so you can never
retrieve the text you sent from guest.
You can automate it with a simple batch file:
@echo off
REM ensure that copy & paste is enabled
vmpref +c
REM copy data from stdin
vmscr
REM now disable copy & paste
vmpref -c
Options:
None.
Examples:
When combined with vmpaste you can take a
"screen shot" of DOS guest within the guest alone,
borrowing host's clipboard.
vmscr
vmpaste > screen.txt
Reads text data from host's clipboard and write it to standard output.
Like vmcopy, it is intended to be used with pipe
and/or redirection.
VMware passes 65,355 bytes at maximum, and both DOS16 and WIN32 versions can handle that much. When host's clipboard holds larger data than that, VMware doesn't pass any data to guest.
VMware's copy & paste feature must be enabled for this program to work. Other precautions mentioned in vmcopy section are not necessary.
Unlike other VMTools Command Line Tools programs, this program writes error message to standard error (WIN32) or directly to screen (DOS16) because standard output is likely to be redirected.
Options:
None.
Examples:
To save text from host's clipboard to a file:
vmpaste > somefile.txtTo send text from host's clipboard to other program:
vmpaste | sort > sorted.txt
This program causes VMware to popup the
A bootable CD-ROM disc, floppy diskette,
or hard disk was not detected.
dialog in the host. I have no idea how this can be useful for
anyone, but I've included this anyway for the sake of itself.Options:
None.
Here are some notes about compiling/assembling VMware Command Line Tools from source files. Mostly it should be pretty straight forward if you have ever written a program yourself.
About C source files (WIN32)
About assembly source files (DOS16)