@ECHO OFF
CLS
color 0a

GOTO MENU
:MENU
ECHO.
ECHO.                  =-=-=-=-=请选择要启动的服务项目=-=-=-=-=
ECHO.
ECHO.                       1  启动-本机网络服务（桥接,直接连接外网）
ECHO.
ECHO.                       2  启动-USB和COM服务
ECHO.
ECHO.                       3  启动-DHCP和NAT服务（共享上网，默认安装虚拟网卡8）
ECHO.
ECHO.                       4  启动-用户权限服务
ECHO.
ECHO.                       5  安装-本地网络
ECHO.
ECHO.                       6     退   出
ECHO.
ECHO.
ECHO.
"%cd%\choice.exe" /C 123456789 /N /M 请输入选择项目的序号：
IF ERRORLEVEL 1 IF NOT ERRORLEVEL 2 GOTO SERVICE1
IF ERRORLEVEL 2 IF NOT ERRORLEVEL 3 GOTO SERVICE2
IF ERRORLEVEL 3 IF NOT ERRORLEVEL 4 GOTO SERVICE3
IF ERRORLEVEL 4 IF NOT ERRORLEVEL 5 GOTO SERVICE4
IF ERRORLEVEL 5 IF NOT ERRORLEVEL 6 GOTO SERVICE5
IF ERRORLEVEL 6 GOTO END

PAUSE

:SERVICE1
"%cd%\netcfg.exe" -l "%cd%\drivers\netbridge.inf" -c s -i vmware_bridge
net start VMNETBRIDGE
GOTO MENU

:SERVICE2
sc create hcmon type= kernel start= auto binpath= "%cd%\drivers\hcmon.sys" displayname= "VMware hcmon"
net start hcmon
SC CREATE Vmparport TYPE= KERNEL BINPATH= "%cd%\drivers\VMPARPORT.SYS" GROUP= "EXTENDED BASE" DISPLAYNAME= "VMware VMparport"
net start Vmparport
GOTO MENU

:SERVICE3
sc create "VMware NAT Service" start= auto  binpath= "%cd%\vmnat.exe"  depend= "VMnetuserif" displayname= "VMware NAT Service"
set regadd=reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VMware NAT Service\Parameters
%regadd%" /v "ConfigPath" /d "%cd%" /f
sc create VMnetDHCP start= auto  binpath= "%cd%\VMnetDHCP.exe"  depend= "VMnetuserif" displayname= "VMware DHCP Service"
set regadd=reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VMnetDHCP\Parameters
%regadd%" /v "ConfFile" /d "%cd%\vmnetdhcp.conf" /f
%regadd%" /v "LeaseFile" /d "%cd%\vmnetdhcp.leases" /f
"%cd%\devcon.exe" -R INSTALL "%cd%\drivers\netadapter.inf" *VMnetAdapter8
start /wait vnetlib -- add dhcp vmnet8
start /wait vnetlib -- add nat vmnet8
start /wait vnetlib -- stop nat
start /wait vnetlib -- set vnet vmnet8 addr 192.168.203.0
start /wait vnetlib -- stop dhcp
start /wait vnetlib -- update dhcp vmnet8
start /wait vnetlib -- start dhcp
start /wait vnetlib -- update nat vmnet8
start /wait vnetlib -- start nat
start /wait vnetlib -- update adapter vmnet8
GOTO MENU

:SERVICE4
sc create VMAuthdService  start= auto binpath= "%cd%\vmware-authd.exe"  depend= "vmx86" displayname= "VMware Authorization Service"
net start VMAuthdService
GOTO MENU

:SERVICE5
sc create VMnetDHCP start= auto  binpath= "%cd%\VMnetDHCP.exe"  depend= "VMnetuserif" displayname= "VMware DHCP Service"
set regadd=reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VMnetDHCP\Parameters
%regadd%" /v "ConfFile" /d "%cd%\vmnetdhcp.conf" /f
%regadd%" /v "LeaseFile" /d "%cd%\vmnetdhcp.leases" /f
"%cd%\devcon.exe" -R INSTALL "%cd%\drivers\netadapter.inf" *VMnetAdapter1
start /wait vnetlib -- add dhcp vmnet1
start /wait vnetlib -- set vnet vmnet1 addr 10.10.10.0
start /wait vnetlib -- stop dhcp
start /wait vnetlib -- update dhcp vmnet1
start /wait vnetlib -- start dhcp
start /wait vnetlib -- update adapter vmnet1
GOTO MENU
:END
