@echo off
echo 正在添加IIS，可能需要几分钟到几十分钟，具体取决于网速及缺失组件数量
if "%1" == "noWait" goto startTask
echo 注：请“以管理员身份运行”该文件
if not exist "%windir%\Microsoft.NET\Framework\v3.5" echo 注：若有Win8安装文件，可离线安装.net 3.5。用记事本打开本文件，详见rem部份
rem 离线安装.net 3.5：在下一行后面添加“ /Source:G:\sources\sxs”（请将G改为Win8安装盘盘符)，保存后重新“以管理员身份运行”
dism /Online /Enable-Feature /FeatureName:NetFX3 /NoRestart
:startTask
dism /Online /Enable-Feature /FeatureName:IIS-WebServerRole /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-WebServer /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-CommonHttpFeatures /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-StaticContent /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-DefaultDocument /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-DirectoryBrowsing /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-HttpErrors /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-HttpRedirect /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-ApplicationDevelopment /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-NetFxExtensibility /all /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-ASPNET /all /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-ASP /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-ISAPIExtensions /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-ISAPIFilter /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-HealthAndDiagnostics /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-HttpLogging /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-LoggingLibraries /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-RequestMonitor /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-HttpTracing /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-Security /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-BasicAuthentication /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-WindowsAuthentication /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-DigestAuthentication /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-URLAuthorization /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-RequestFiltering /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-IPSecurity /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-Performance /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-WebServerManagementTools /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-ManagementConsole /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-ManagementScriptingTools /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-ManagementService /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-IIS6ManagementCompatibility /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-Metabase /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-WMICompatibility /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-LegacyScripts /NoRestart
dism /Online /Enable-Feature /FeatureName:IIS-LegacySnapIn /NoRestart
dism /Online /Enable-Feature /FeatureName:WAS-WindowsActivationService /NoRestart
dism /Online /Enable-Feature /FeatureName:WAS-ProcessModel /NoRestart
dism /Online /Enable-Feature /FeatureName:WAS-NetFxEnvironment /NoRestart
dism /Online /Enable-Feature /FeatureName:WAS-ConfigurationAPI /NoRestart
echo 操作已处理完毕!
if "%1" NEQ "noWait" pause

