@echo off
set INSTDIR=d:\SOFT_PHP_PACKAGE
if NOT Exist %INSTDIR% md %INSTDIR%
if NOT Exist %INSTDIR% (
	echo "安装目录不存在，安装中止"
	exit
)

REM ===========================IIS-ASP.net============

echo 自动安装IIS组件
software\ServerManagerCmd.exe -install Web-Server Web-Common-Http Web-Static-Content Web-Default-Doc Web-Dir-Browsing Web-Http-Errors Web-Http-Redirect Web-App-Dev Web-Asp-Net Web-Net-Ext Web-ASP Web-CGI Web-ISAPI-Ext Web-ISAPI-Filter Web-Includes Web-Health Web-Http-Logging Web-Log-Libraries Web-Request-Monitor Web-Http-Tracing Web-Custom-Logging Web-ODBC-Logging Web-Security Web-Basic-Auth Web-Windows-Auth Web-Digest-Auth Web-Client-Auth Web-Cert-Auth Web-Url-Auth Web-Filtering Web-IP-Security Web-Performance Web-Stat-Compression Web-Dyn-Compression Web-Mgmt-Tools Web-Mgmt-Console Web-Scripting-Tools Web-Mgmt-Compat Web-Metabase Web-WMI
echo 开始安装Asp.net 4.0，时间较久，请勿中断本窗口
start /wait software\dotnetfx45_full_x86_x64.exe /q /norestart
start /wait software\rewrite_2.0_rtw_x64.msi /quiet
start /wait software\vcredist_x64.exe /q
del d:\eula.*.txt /q
del d:\globdata.ini /q
del d:\install.exe /q
del d:\install.ini /q
del d:\install.res.*.dll /q
del d:\VC_RED.* /q
del d:\vcredist.bmp /q

REM ===========================PHP============

md %INSTDIR%\php
md %INSTDIR%\php_64bit
md %INSTDIR%\phptmp


cacls %INSTDIR%\php /e /g everyone:r
cacls %INSTDIR%\phptmp /e /g everyone:f
cacls d:\ /e /g everyone:r

xcopy php %INSTDIR%\php\ /e /c /q /h /r /y
xcopy php_64bit %INSTDIR%\php_64bit\ /e /c /q /h /r /y

md %INSTDIR%\Zend
cacls %INSTDIR%\Zend /e /g everyone:r

xcopy Zend %INSTDIR%\Zend /e /c /q /h /r /y


REM ===========================PHPMYADMIN============

md %INSTDIR%\phpmyadmin
cacls %INSTDIR%\phpmyadmin /e /g everyone:r

xcopy phpmyadmin %INSTDIR%\phpmyadmin /e /c /q /h /r /y

REM ===========================MYSQL============

md %INSTDIR%\mysql
net user mysql china2008go /add
kit\ntrights.exe +R SeServiceLogonRight -u mysql
cacls %INSTDIR%\mysql /e /g mysql:r
xcopy mysql %INSTDIR%\mysql /e /c /q /h /r /y
echo y|cacls %INSTDIR%\mysql /t /P administrators:f mysql:f
%INSTDIR%\mysql\bin\mysqld.exe --install
sc config mysql obj= .\mysql password= china2008go
net start mysql

echo 自动修改本地策略中的密码永不过期及密码复杂度策略
secedit /configure /db gp.sdb /cfg kit\security.inf /quiet
gpupdate
cscript install.vbs
cscript firewall.vbs
regedit /s inst.reg