http://www.cnblogs.com/aierong/archive/2012/05/28/2521409.html
利用小工具instsrv和srvany的自动化脚本:
set toolPath=C:\Tools
set serviceName=VMInstanceMonitor
set serviceDisplayName="VM Instance Monitor"
set serviceDescription="Monitor VM instance and operate the instances"
set appName=VMInstanceMonitor.exe
set appDirectory=C:\VMInstanceMonitorTest
::1 Install
%toolPath%\instsrv.exe %serviceName% %toolPath%\srvany.exe
reg ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\%serviceName%\Parameters
reg ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\%serviceName%\Parameters /v Application /t REG_SZ /d %appName%
reg ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\%serviceName%\Parameters /v AppDirectory /t REG_SZ /d %appDirectory%
sc config %serviceName% DisplayName= %serviceDisplayName%
sc description %serviceName% %serviceDescription%
sc start %serviceName%
::2 Uninstall
::%toolPath%\instsrv.exe %serviceName% REMOVE