Vmrun batch file execution

From VI-Toolkit
Jump to: navigation, search

In order to use vmrun to run a batch file on a Windows guest, you can use RunProgramInGuest and explicity call cmd.exe with the /c switch.

vmrun -T ws -gu USERNAME -gp PASSWORD runProgramInGuest "C:\Virtual Machines\WinXP2\WinXP2.vmx" %COMSPEC% "/c C:\batch.bat"

This command will issue %COMSPEC%, which is a pointer to cmd.exe, to run the batch file C:\batch.bat on the WinXP2 virtual machine.