本帖最后由 不会写信 于 2012-11-9 01:38 编辑
用这个不用开admin就能安装,而且解决了WIN8下不识别“%CD%"变量的问题- cd /d %~dp0
- cls
- @echo off
- CLS
- color 0a
- Title VMware 9.0.0 绿色精简汉化版
- set vmbit=
- echo 提示:最好在安装之前,先运行一下"!)卸载VMware.cmd"文件,以免旧版本干扰新版本安装
- echo.
- echo 注意:
- echo 运行此批处理文件后,安装过程持续十几秒钟,并将跳出VMware服务安装窗口.
- echo 如果窗口一闪而过,说明安装过程中出了错误.
- echo 未正确安装VMware将导致虚拟机运行出错.
- echo 请先排除故障后再次运行"!)安装VMware.cmd"批处理文件进行安装.
- echo.
- echo 按任意键继续安装VMware&pause>nul
- reg query "HKLM\SOFTWARE\VMware, Inc." >nul 2>nul || reg query "HKLM\SOFTWARE\Wow6432Node\VMware, Inc." >nul 2>nul&&(echo.&echo 系统中已经安装了VMware,请先卸载干净并重启电脑!!!&pause>nul&exit)
- cls
- echo ................
- echo 正在安装VMware 9.0.0 绿色精简汉化版,请稍后...
- echo ................
- echo.
- rd /s /q "%AllUsersProfile%\VMware" >nul 2>nul
- rd /s /q "%AllUsersProfile%\Application Data\VMware" >nul 2>nul
- rd /s /q "%AppData%\VMware" >nul 2>nul||del /f /s /q "%AppData%\VMware" >nul 2>nul
- ver|find "6.">nul && (set profilepath=%AllUsersProfile%)
- ver|find "5.">nul && (set profilepath=%AllUsersProfile%\Application Data)
- md "%AppData%\VMware" >nul
- if %errorlevel% neq 0 echo 创建目录失败,请关闭杀毒软件或者HIPS后再重新安装VMware&pause>nul&exit
- md "%profilepath%\VMware" >nul
- md "%profilepath%\VMware\VMware Workstation" >nul
- md "%profilepath%\VMware\VMware Player" >nul
- md "%profilepath%\VMware\VMware USB Arbitration Service" >nul
- if "%PROCESSOR_ARCHITECTURE%" neq "x86" goto _64
- goto _86
- :_64
- set vmbit=64
- if not exist "%cd%\64Drv" (echo.&echo 64Drv文件夹不存在或者已被删除,安装文件不全,请下载完整版!!!&pause>nul&exit)
- echo 添加注册表项目...
- regedit /s "%cd%\vm64.reg"
- reg query "HKLM\SOFTWARE\Wow6432Node\VMware, Inc.\Installer" >nul 2>nul||(echo.&echo 注册表文件vm64.reg导入失败,请关闭杀毒软件或者HIPS后再重新安装VMware&rd /s /q "%AppData%\VMware"&rd /s /q "%profilepath%\VMware"&pause>nul&exit)
- reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\VMware, Inc.\Installer\VMware Workstation\Features" /v core /t REG_SZ /d "%cd%" /f
- reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\VMware, Inc.\VMware Player" /v InstallPath /t REG_SZ /d "%cd%\" /f
- reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\VMware, Inc.\VMware Player" /v InstallPath64 /t REG_SZ /d "%cd%\x64\" /f
- reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\VMware, Inc.\VMware Workstation" /v InstallPath /t REG_SZ /d "%cd%\" /f
- reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\VMware, Inc.\VMware Workstation" /v InstallPath64 /t REG_SZ /d "%cd%\x64\" /f
- reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{4B6C7001-C7D6-3710-913E-5BC23FCE91E6} >nul 2>nul||(echo.&echo 正在安装VC++2008......)
- copy /y 64Drv\*.* >nul
- ver|find "5.">nul && (
- copy /y 64Drv\bridge\_vmnetbridge.cat_xp_64 .\vmnetBridge.cat >nul
- copy /y 64Drv\bridge\_vmnetBridge.dll_xp_64 .\vmnetBridge.dll >nul
- copy /y 64Drv\bridge\_vmnetBridge.sys_xp_64 .\vmnetBridge.sys >nul
- )
- ver|find "6.">nul && (
- copy /y 64Drv\bridge\_vmnetbridge.cat_vista_64 .\vmnetBridge.cat >nul
- copy /y 64Drv\bridge\_vmnetBridge.dll_vista_64 .\vmnetBridge.dll >nul
- copy /y 64Drv\bridge\_vmnetBridge.sys_vista_64 .\vmnetBridge.sys >nul
- )
- copy /y vmci\x64\* .\ >nul
- copy /y vmci\vsocklib64.dll .\ >nul
- echo.
- goto install
- :_86
- if not exist "%cd%\86Drv" (echo.&echo 86Drv文件夹不存在或者已被删除,安装文件不全,请下载完整版!!!&pause>nul&exit)
- echo 添加注册表项目...
- regedit /s "%cd%\vm86.reg"
- reg query "HKLM\SOFTWARE\VMware, Inc.\Installer" >nul 2>nul||(echo.&echo 注册表文件vm86.reg导入失败,请关闭杀毒软件或者HIPS后再重新安装VMware&rd /s /q "%AppData%\VMware"&rd /s /q "%profilepath%\VMware"&pause>nul&exit)
- reg add "HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\Installer\VMware Workstation\Features" /v core /t REG_SZ /d "%cd%" /f
- reg add "HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMware Player" /v InstallPath /t REG_SZ /d "%cd%\" /f
- reg add "HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMware Workstation" /v InstallPath /t REG_SZ /d "%cd%\" /f
- reg add "HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMware Workstation" /v DATASTORE_PATH /t REG_SZ /d "%cd%\\VOS" /f
- reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1F1C2DFC-2D24-3E06-BCB8-725134ADF989} >nul 2>nul||reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{86CE1746-9EFF-3C9C-8755-81EA8903AC34} >nul 2>nul||(echo.&echo 正在安装VC++2008......)
- copy /y 86Drv\*.* >nul
- ver|find "5.">nul && (
- copy /y 86Drv\bridge\_vmnetbridge.cat_xp .\vmnetBridge.cat >nul
- copy /y 86Drv\bridge\_vmnetBridge.dll_xp .\vmnetBridge.dll >nul
- copy /y 86Drv\bridge\_vmnetBridge.sys_xp .\vmnetBridge.sys >nul
- )
- ver|find "6.">nul && (
- copy /y 86Drv\bridge\_vmnetbridge.cat_vista_32 .\vmnetBridge.cat >nul
- copy /y 86Drv\bridge\_vmnetBridge.dll_vista_32 .\vmnetBridge.dll >nul
- copy /y 86Drv\bridge\_vmnetBridge.sys_vista_32 .\vmnetBridge.sys >nul
- )
- copy /y vmci\x86\* .\ >nul
- copy /y vmci\vsocklib.dll .\ >nul
- echo.
- :install
- str.exe preferences.ini 0 0 /R /asc:"VMwareDir" /asc:"%cd%" /A >nul 2>nul
- str.exe environments.xml 0 0 /R /asc:"VMwareDir" /asc:"%cd%" /A >nul 2>nul
- echo 复制文件...
- echo.
- copy /y preferences.ini "%AppData%\VMware" >nul
- copy /y inventory.vmls "%AppData%\VMware" >nul
- copy /y vmconfig.ini "%profilepath%\VMware\VMware Workstation\config.ini" >nul
- copy /y settings.ini "%profilepath%\VMware\VMware Player" >nul
- copy /y settings.ini "%profilepath%\VMware\VMware Workstation" >nul
- copy /y vpconfig.ini "%profilepath%\VMware\VMware Player\config.ini" >nul
- copy /y vnetinst.dll "%WinDir%\System32" >nul
- copy /y vnetlib%vmbit%.dll "%WinDir%\System32" >nul
- move /y vsock.sys "%WinDir%\system32\drivers" >nul 2>nul
- move /y vsocklib.dll "%WinDir%\system32" >nul 2>nul
- echo.
- echo 注册所需的DLL文件...
- regsvr32 /s vmappcfg.dll
- regsvr32 /s vmappsdk.dll
- regsvr32 /s vmdbCOM.dll
- echo.
- echo 创建 __vmware_user__ 用户组 ...
- net localgroup users __vmware_user__ /del >nul 2>nul
- net localgroup __vmware__ /del >nul 2>nul
- net user __vmware_user__ /del >nul 2>nul
- echo.
- net localgroup __vmware__ /add /comment:"VMware User Group" >nul
- if %errorlevel% neq 0 echo 用户组创建失败,请关闭杀毒软件或者HIPS后再重新安装VMware&pause>nul&exit
- echo 安装VM基本服务 ...
- reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VMware\Performance" /v Library /t REG_SZ /d "%cd%\vmPerfmon.dll" /f
- sc create vsock type= kernel start= boot binpath= "%WinDir%\system32\drivers\vsock.sys" Group= "System Bus Extender" displayname= "vSockets Driver"
- net stop vmx86 >nul 2>nul
- sc delete vmx86 >nul 2>nul
- start /wait vnetlib%vmbit%.exe -- install vmx86
- start /wait vnetlib%vmbit%.exe -- start vmx86
- net stop vmx86 >nul
- net start vmx86 >nul
- if %errorlevel% neq 0 echo 服务启动失败,请关闭杀毒软件或者HIPS后,再运行"卸载VMware.cmd"清理安装记录,然后重新安装VMware&pause>nul&exit
- net stop vmci >nul 2>nul
- sc delete vmci >nul 2>nul
- if "%PROCESSOR_ARCHITECTURE%" equ "x86" (DrvInst.exe -install "ROOT\VMWVMCIHOSTDEV" .\vmci.inf >nul)
- if "%PROCESSOR_ARCHITECTURE%" neq "x86" (DrvInst64.exe installRootDriver HWND "ROOT\VMWVMCIHOSTDEV" .\vmci.inf "" >nul)
- vnetlib%vmbit%.exe -- install vmci
- if not exist "%WinDir%\System32\Drivers\vsock.sys" copy /y vsock.sys "%WinDir%\System32\Drivers"
- net start vsock >nul
- echo 创建快捷方式
- mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\VMware.lnk""):b.TargetPath=""%~dp0vmware.exe"":b.WorkingDirectory=""%~dp0"":b.Save:close") >nul
- echo.
- echo.
- echo.
- echo 请注意上面错误提示,若安装后无法正常运行VMware,
- echo 请把上面的错误提示复制下来反馈到我的帖子里,谢谢.
- echo 按任意键继续安装VMware服务.
- pause >nul
- :ST
- CALL "!)安装服务.cmd"
- :EX
- exit
- :prompt
- echo ..................
- echo 提示:现在登录系统的并非是administrator用户
- echo 安装VMware请切换到administrator管理员用户!
- echo 如果系统未激活administrator用户,请在CMD
- echo 命令行下使用"net user administrator /active:yes"
- echo 这条命令激活administrator用户,这样注销系统后
- echo 就能看到administrator账户了。登陆administrator
- echo 用户就能安装VMware了。如果administrator用户名
- echo 已经更名,在Vista/Win7/2008系统下,登陆改了名字
- echo 的超级管理员账号,然后把此批处理的以"ver|find"开头
- echo 的第9行和第10行删除掉再进行安装VMware。
- echo ..................
- pause
- goto :EX
复制代码 |