Hacking 'Repeatable Save State Restore' into Virtual PC

One feature that people regularly ask for in Virtual PC is the ability to have a virtual machine in a 'saved state' and to then be able to repeatedly restore the virtual machine from that saved state. This is particularly useful for training and demonstration environments. Unfortunately - we have never implemented support for this functionality directly - but it is fairly easy to setup with a few tweaks, as follows:

  1. Setup your virtual machine the way you want it

  2. Enable undo disks

  3. Get the virtual machine to the stage that you want to repeatedly restore from

  4. Close the virtual machine and select to 'Save state and save undo disks' - as well as checking the option to commit the undo disks

  5. Open the virtual machine settings and go to the close settings and select to 'Automatically close without a message and: Turn off and delete changes'

    Now it gets a little tricky.

  6. Go to the location where your .VMC is stored (usually in the 'My Virtual Machines' folder in 'My Documents')

  7. There should be a .VMC and .VSV file - these are the configuration and saved state files

  8. Create a subfolder called 'Backup' and copy these two files into it

  9. Now make a new .CMD file with the following contents:

    @ECHO OFF
    copy .Backup. . /y > nul
    start "" "C:Program FilesMicrosoft Virtual PCVirtual PC.exe" -startvm "F:Ben's DocumentsMy Virtual MachinesWindows 98Windows 98.vmc"

    (substituting the name and location of the .VMC file with your .VMC file)

  10. You can now start the virtual machine by running this .CMD file - and it will always start from the saved state you made in step 4.

A couple of notes:

  1. The '@ECHO OFF' and ' > nul' commands are used to stop any text from being displayed by the .CMD file when it runs
  2. The 'start ""' command is used to allow the .CMD window to close as soon as the virtual machine is started
  3. You need to use the full path for the .VMC file - otherwise you will get an error message from Virtual PC - complaining about duplicate virtual machine names.
  4. The .CMD file should only be three lines long - but the last line is very long - and will probably be wrapped on the post.

Cheers,
Ben