服务器IIs 重装 卸载终极命令行解决方案


大家复制下面的代码保存为.bat的批处理文件执行就行

@Echo off
Color A
TITLE
:: 批处理参数调用
if “%1″==”1″ Goto Install
if “%1″==”2″ Goto Uninstall
Goto Menu
:Menu
set id=
cls
@echo.
@echo.
@echo. && @echo ==== 安装-卸载 ====
@echo. && @echo 1. 安装
@echo. && @echo 2. 卸载
@echo. && @echo X. 退出
@echo.
set /p id= 请选择:
if “%id%”==”1″ Goto Install
if “%id%”==”2″ Goto Uninstall
if “%id%”==”R” shutdown -r -t 0
if “%id%”==”r” shutdown -r -t 0
if “%id%”==”X” exit
if “%id%”==”x” exit
Goto Menu
:: *******************
:: * 安装
:: *******************
:Install
Cls
@echo. && @echo 安装正在进行中…
:: 生成 IIS 6.0 安装脚本,启用 ASP,ASP.NET
@echo [Components]> %TEMP%\IIS_Install.txt
@echo iis_common = ON>> %TEMP%\IIS_Install.txt
@echo iis_www = ON>> %TEMP%\IIS_Install.txt
@echo iis_asp = ON>> %TEMP%\IIS_Install.txt
@echo iis_inetmgr = ON>> %TEMP%\IIS_Install.txt
@echo aspnet = ON>> %TEMP%\IIS_Install.txt
:: 安装 IIS 6.0
%windir%\System32\Sysocmgr.exe /i:sysoc.inf /u:%TEMP%\IIS_Install.txt
del /q /f %windir%\*.log >nul 2>nul
del /q /f %TEMP%\IIS_Install.txt >nul 2>nul
del /q /f %TEMP%\ASPNETSetup.log >nul 2>nul
:: 配置 IIS 启用父路径
@cscript /nologo C:\Inetpub\AdminScripts\adsutil.vbs set W3SVC/AspEnableParentPaths 1 >nul 2>nul
Goto Install_End
:: *******************
:: * 卸载
:: *******************
:Uninstall
Cls
@echo. && @echo 卸载正在进行中…
:: 生成 IIS 6.0 卸载脚本
@echo [Components]> %TEMP%\IIS_Uninstall.txt
@echo iis_common = OFF>> %TEMP%\IIS_Uninstall.txt
@echo iis_www = OFF>> %TEMP%\IIS_Uninstall.txt
@echo iis_asp = OFF>> %TEMP%\IIS_Uninstall.txt
@echo iis_inetmgr = OFF>> %TEMP%\IIS_Uninstall.txt
@echo aspnet = OFF>> %TEMP%\IIS_Uninstall.txt
:: 卸载 IIS 6.0
%windir%\System32\Sysocmgr.exe /i:sysoc.inf /u:%TEMP%\IIS_Uninstall.txt
del /q /f %windir%\*.log >nul 2>nul
del /q /f %TEMP%\IIS_Uninstall.txt >nul 2>nul
del /q /f %TEMP%\ASPNETSetup.log >nul 2>nul
Goto Uninstall_End
:: *******************
:: * 退出
:: *******************
:Install_End
Cls
Color B
@echo. && @echo. && @echo 安装结束 按任意键退出
Pause >nul 2>nul
:: 删除安装文件
:: del %0 >nul 2>nul
Exit
:Uninstall_End
Cls
Color B
@echo. && @echo. && @echo 卸载结束 按任意键退出
Pause >nul 2>nul
:: 删除安装文件
:: del %0 >nul 2>nul
Exit

 

关闭
18988993509

020-82315523