@echo off
cls
color 0a
echo.
echo               VMware workstation-6.5.3-185404 绿色精简版
echo.
echo.
echo                                 即将进行安装，是否要继续......
echo.     
echo ---------------------------------------------------------------------------
echo.
SET /P ST=   请输入 Y (继续安装)或 N (退出安装)：
echo.
if /I "%ST%"=="Y" goto ST
if /I "%ST%"=="N" goto EX
goto EX

:ST
copy /y vmusb.cat %systemroot%\inf\vmusb.cat
copy /y vmusb.inf %systemroot%\inf\vmusb.inf
copy /y vmusb.sys %systemroot%\inf\vmusb.sys
copy /y vmusb.sys %systemroot%\inf\VMUSB.PNF
copy /y vmusb.sys %systemroot%\system32\drivers\vmusb.sys
:regdll
regsvr32 /s vmappcfg.dll
regsvr32 /s vmappsdk.dll
regsvr32 /s vmdbCOM.dll

:addreg
echo 正在添加注册表项目...
reg delete  "HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc." /f >nul 2>nul
set regadd=reg add "HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.
%regadd%" /v Core /d "VMware Workstation" /f
set regadd=%regadd%\VMware Workstation
%regadd%" /v "InstallPath" /d "%cd%" /f
set regadd=%regadd%\License.ws.6.0.200907
%regadd%" /v "StartFields" /d "Cpt, ProductID, LicenseVersion, LicenseType, Epoch" /f
%regadd%" /v "Cpt" /d "COPYRIGHT (c) VMware, Inc. 1999-2007" /f
%regadd%" /v "ProductID" /d "VMware Workstation for Win32" /f
%regadd%" /v "LicenseVersion" /d "6.0" /f
%regadd%" /v "LicenseType" /d "User" /f
%regadd%" /v "Epoch" /d "2009-7-1" /f
%regadd%" /v "Hash" /d "6b3d34d9-b34f898e-2600b82e-9f65a272-44f2afe8" /f
%regadd%" /v "Serial" /d "D1WA8-D0KFV-8D19F-45ZFA" /f
%regadd%" /v "Name" /d "USER" /f
%regadd%" /v "CompanyName" /d "MSHOME" /f
set regadd=reg add "HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMware Player
%regadd%" /v "InstallPath" /d "%cd%" /f

:adduser
echo 开始创建 __vmware_user__ 账户 ... 
net user __vmware_user__ /add >nul
net localgroup __vmware__ /add >nul
net localgroup users __vmware_user__ /del >nul
net localgroup __vmware__ __vmware_user__ /add >nul

:Start VM basic service
echo 装载虚拟机需要基本服务 ... 
sc create vmci type= kernel start= auto binpath= "%cd%\vmci.sys" displayname= "VMware vmci" group= "Extended base"
net start vmci

sc create vmx86 type= kernel start= auto binpath= "%cd%\vmx86.sys" displayname= "VMware Virtualization Driver" 
net start vmx86

sc create VMnetuserif type= kernel start= auto binpath= "%cd%\vmnetuserif.sys" displayname= "VMware Network Application Interface"
net start VMnetuserif

sc create VMnetDHCP 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

sc create "VMware NAT Service" 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

call server.cmd