@shift 1
@echo off
CLS
color 0a
echo.
echo               VMware Workstation-6.5.2 绿色汉化版 www.52z.com
echo.
echo     （请确认存放VMware的文件夹及路径不含空格，否则现在关闭窗口并修改）
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
md %systemdrive%\Docume~1\%username%\「开始」菜单\程序\VMware
SHORTCUT.EXE -f -t vmware.exe -n "%USERPROFILE%\「开始」菜单\程序\VMware"\VMware绿色汉化版
SHORTCUT.EXE -f -t vmplayer.exe -n "%USERPROFILE%\「开始」菜单\程序\VMware"\VMwarePlayer
SHORTCUT.EXE -f -t vmware-tray.exe -n "%USERPROFILE%\「开始」菜单\程序\VMware"\VMwaretray
SHORTCUT.EXE -f -t %cd% -n "%USERPROFILE%\「开始」菜单\程序\VMware"\打开VMware文件夹

reg import 1.reg
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
echo 正在注册所需的DLL文件....
regsvr32 /s "%cd%/vmappcfg.dll"
regsvr32 /s "%cd%/vmappsdk.dll"
regsvr32 /s "%cd%/vmdbCOM.dll"


:addreg
echo 正在添加注册表项目...
set regadd=reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup
%regadd%" /v "SourcePath" /d "%systemroot%\inf" /f
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=reg add "HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMware Player
%regadd%" /v "BuildNumber" /d "156735" /f
%regadd%" /v "ProductVersion" /d "6.5.2.7026" /f
%regadd%" /v "InstallPath" /d "%cd%" /f
set regadd=reg add "HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMware Converter Hosted
%regadd%" /v "InstallPath" /d "%cd%" /f
@reg  add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdrom" /v "Autorun" /d "0" /f

:adduser
echo 开始创建 __vmware_user__ 账户 ...
net user __vmware_user__ /add /comment:"VMware User" /fullname:"__vmware_user__"
net localgroup __vmware__ /add /comment:"VMware User Group"  >nul
net localgroup users __vmware_user__ /del >nul
net localgroup __vmware__ __vmware_user__ /add >nul

:Start VM basic service
echo 装载虚拟机需要基本服务 ...
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 vmci type= kernel start= auto binpath= "%cd%\vmci.sys" displayname= "Virtual Machine Communication Interface Driver"
net start vmci
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
CALL 服务配置.cmd
