@echo off & color 0A |
title 备份IIS |
echo . |
echo . |
echo "导出iis配置..." |
::默认以时间为目录名 或者 appcmd add backup "备份目录" |
c:\windows\system32\inetsrv\appcmd add backup |
echo . |
echo . |
echo "创建备份目录..." |
md "D:\Service\Soft\IISconfigBackup" |
echo . |
echo . |
echo "复制到备份目录..." |
xcopy /s /y C:\Windows\System32\inetsrv\backup D:\Service\Soft\IISconfigBackup |
echo . |
echo . |
dir "D:\Service\Data\IISconfigBackup" |
echo . |
echo . |
echo 正在加载延时代码,五秒后自动关闭..." |
echo if wscript.arguments(0)^>0 then wscript.Sleep(wscript.arguments(0) * 1000):end if>"%Temp%\delay01.vbs" |
cscript "%temp%\delay01.vbs" 5 |
del "%Temp%\delay01.vbs 还原当然要手动还原了 把备份文件copy到C:\Windows\System32\inetsrv\backup :: 列出所有备份 CFGHISTORY开头的文件是系统自己备份的
appcmd list backup :: 还原备份
appcmd restore backup "备份名称" |