@echo off
set curdir=%~dp0
set SystemDrive_xn=c:
set WINSYSDIR_xn=%windir%\system32
cd /d %curdir%

echo 正在安装 msiexec服务 ......................
msiexec /regserver /quiet
sc.exe config msiserver start= auto

echo 正在安装 WindowsInstaller3 ......................
"%curdir%\WindowsInstaller-KB893803-v2-x86.exe" /passive /norestart

echo 开始解压缩.Net Framework2.0SP2安装文件.......................................
if NOT EXIST "%WINDIR%\Microsoft.NET\Framework\v2.0.50727" (
if EXIST  %SystemDrive_Xn%\netfx20sp2\x86  rd /s/q %SystemDrive_Xn%\netfx20sp2\x86
netfx20sp2_x86.exe /q /x:%SystemDrive_Xn%\netfx20sp2\x86
"%WINSYSDIR_xn%\msiexec.exe" /a "%SystemDrive_Xn%\netfx20sp2\x86\wcu\dotnetframework\dotnetfx20\netfx20a_x86.msi" TARGETDIR="%SystemDrive_Xn%\netfx20sp2\x86\AIP" 
echo 解压缩.Net Framework2.0SP2安装文件完成.......................................
"%WINSYSDIR_xn%\msiexec.exe" /a "%SystemDrive_Xn%\netfx20sp2\x86\AIP\netfx20a_x86.msi" PATCH="%SystemDrive_Xn%\netfx20sp2\x86\wcu\dotnetframework\dotnetfx20\ASPNET.msp;%SystemDrive_Xn%\netfx20sp2\x86\wcu\dotnetframework\dotnetfx20\CLR.msp;%SystemDrive_Xn%\netfx20sp2\x86\wcu\dotnetframework\dotnetfx20\CRT.msp;%SystemDrive_Xn%\netfx20sp2\x86\wcu\dotnetframework\dotnetfx20\NetFX_CA.msp;%SystemDrive_Xn%\netfx20sp2\x86\wcu\dotnetframework\dotnetfx20\NetFX_Core.msp;%SystemDrive_Xn%\netfx20sp2\x86\wcu\dotnetframework\dotnetfx20\NetFX_Other.msp;%SystemDrive_Xn%\netfx20sp2\x86\wcu\dotnetframework\dotnetfx20\PreXP.msp;%SystemDrive_Xn%\netfx20sp2\x86\wcu\dotnetframework\dotnetfx20\WinForms.msp;%SystemDrive_Xn%\netfx20sp2\x86\wcu\dotnetframework\dotnetfx20\DW.msp" 
"%WINSYSDIR_xn%\msiexec.exe" /i %SystemDrive_Xn%\netfx20sp2\x86\AIP\netfx20a_x86.msi /l*v %temp%\netfx20sp2x86log.txt /passive /norestart /qb VSEXTUI=1)

echo 正在安装 MICROSOFT SQL SERVER 2005 EXPRESS EDITION SERVICE PACK 3 ......................
start /wait SQLEXPR64_CHS.EXE /qb INSTANCENAME=MSSQLSERVER ADDLOCAL=SQL_Engine SECURITYMODE=SQL SAPWD= INSTALLSQLDATADIR="C:\\Program Files\\Microsoft SQL Server\\" SQLAUTOSTART=1 DISABLENETWORKPROTOCOLS=2
echo 正在安装 Microsoft SQL Server Management Studio Express ......................
msiexec /i SQLServer2005_SSMSEE.msi /quiet /passive
@echo on