4.5 Starting the VM with a batch file

You can create a batch file to start the virtual machine. This makes it easy to start the VM with all the options that you need every time. From the CLI, start notepad to edit the batch file:

notepad startvm.bat  
    

The batch file only needs a single (long) line (the caret ‘^’ symbol is a line continuation symbol in Windows/DOS):

qemu -M pc -hda hd1.qcow2 -m 256^  
 -cdrom deblive.iso -boot d -redir tcp:2222:22^  
 -net nic,vlan=0 -net user,vlan=0,hostname=deblivevm  
    

Let’s take a quick look at the options so that you know how to tweak it:

Unless you know the batch file works, I recommend that you start it from a CLI so that any error will be visible. Once debugged, you can double click the batch file in Windows Explorer to start the virtual machine.