leton
初级用户
积分 170
发帖 72
注册 2007-3-11
状态 离线
|
『楼 主』:
[求助]请教:P问题
请教,如何解决以下问题:日期和时间
2个P,出来结果不一样,我想要的结果是1 详细日期+详细时间
但2中,增加了些东西,影响了结果,要如何解决?
并且,在结果中有个问题,结束时间跟开始时间不知为何是一样?正常备份也需要半小时,看了半天没找到原因..--!
1
@Echo Off
@Title 脚本窗口,请勿关闭.谢谢!
@Setlocal,EnableDelayedExpansion&color 0a
@mode con: cols=64 lines=15
@CLS
@Call %systemroot%\devcon enable *DEV_1648*
@COPY %systemdrive%\数据服务器备份详细日志.txt D:\Domain.Datas\EFS-域用户目录 /Y
@del %systemroot%\RTime1.bat
@del %systemroot%\RTime.bat
@del %systemroot%\Ok1.bat
@del %systemroot%\Ok.bat
@del %systemroot%\Shutdown1.vbs
@del %systemroot%\Shutdown.vbs
@del %systemroot%\One-Week.bat
@del %systemroot%\One-Month.bat
:RTime1
@Echo @Echo Off >> %systemroot%\RTime1.bat
@Echo @Timeout 60 >> %systemroot%\RTime1.bat
@Echo @Call %%systemroot%%\shutdown1.vbs >> %systemroot%\RTime1.bat
@Echo @Exit >> %systemroot%\RTime1.bat
@Goto Rtime
:RTime
@Echo @Echo Off >> %systemroot%\RTime.bat
@Echo @Timeout 60 >> %systemroot%\RTime.bat
@Echo @Call %%systemroot%%\shutdown.vbs >> %systemroot%\RTime.bat
@Echo @Exit >> %systemroot%\Rtime.bat
@Goto Ok1
:OK1
@Echo @Echo Off >> %systemroot%\Ok1.bat
@Echo @Echo 备份完成 %%Date%% 时间 %%Time%% ^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\Ok1.bat
@Echo @Call %%systemroot%%\One-Month.bat >> %systemroot%\Ok1.bat
@Echo @Exit >> %systemroot%\Ok1.bat
@Goto Ok
:OK
@Echo @Echo Off >> %systemroot%\Ok.bat
@Echo @Echo 备份完成 %%Date%% 时间 %%Time%% ^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\Ok.bat
@Echo @Call %%systemroot%%\devcon enable *DEV_1648* >> %systemroot%\Ok.bat
@Echo @Call Shutdown.exe -f -s -t 600 >> %systemroot%\Ok.bat
@Echo @Exit >> %systemroot%\ok.bat
@Goto Shutdown1
:Shutdown1
@Echo strComputer = "." >> %systemroot%\Shutdown1.vbs
@Echo Set objWMIService = GetObject("winmgmts:\\" ^& strComputer ^& "\root\cimv2") >> %systemroot%\Shutdown1.vbs
@Echo Set colProcesses = objWMIService.ExecQuery("Select * from Win32_Process") >> %systemroot%\Shutdown1.vbs
@Echo For Each objProcess in colProcesses >> %systemroot%\Shutdown1.vbs
@Echo If Right(objProcess.Name, 12) = "ntbackup.exe" Then >> %systemroot%\Shutdown1.vbs
@Echo Set objShell = CreateObject("WScript.Shell") >> %systemroot%\Shutdown1.vbs
@Echo objShell.Run "%%systemroot%%\RTime1.bat" >> %systemroot%\Shutdown1.vbs
@Echo Wscript.Quit >> %systemroot%\Shutdown1.vbs
@Echo End If >> %systemroot%\Shutdown1.vbs
@Echo Next >> %systemroot%\Shutdown1.vbs
@Echo Set objShell = CreateObject("WScript.Shell") >> %systemroot%\Shutdown1.vbs
@Echo objShell.Run "%%systemroot%%\Ok1.bat" >> %systemroot%\Shutdown1.vbs
@Echo Wscript.Quit >> %systemroot%\Shutdown1.vbs
@Goto Shutdown
:Shutdown
@Echo strComputer = "." >> %systemroot%\Shutdown.vbs
@Echo Set objWMIService = GetObject("winmgmts:\\" ^& strComputer ^& "\root\cimv2") >> %systemroot%\Shutdown.vbs
@Echo Set colProcesses = objWMIService.ExecQuery("Select * from Win32_Process") >> %systemroot%\Shutdown.vbs
@Echo For Each objProcess in colProcesses >> %systemroot%\Shutdown.vbs
@Echo If Right(objProcess.Name, 12) = "ntbackup.exe" Then >> %systemroot%\Shutdown.vbs
@Echo Set objShell = CreateObject("WScript.Shell") >> %systemroot%\Shutdown.vbs
@Echo objShell.Run "%%systemroot%%\RTime.bat" >> %systemroot%\Shutdown.vbs
@Echo Wscript.Quit >> %systemroot%\Shutdown.vbs
@Echo End If >> %systemroot%\Shutdown.vbs
@Echo Next >> %systemroot%\Shutdown.vbs
@Echo Set objShell = CreateObject("WScript.Shell") >> %systemroot%\Shutdown.vbs
@Echo objShell.Run "%%systemroot%%\Ok.bat" >> %systemroot%\Shutdown.vbs
@Echo Wscript.Quit >> %systemroot%\Shutdown.vbs
@Goto One-Week
REM :: 一星期备份
:One-Week
@Echo @Echo Off >> %systemroot%\One-Week.bat
@Echo.>> %systemroot%\One-Week.bat
@Echo :Week7 >> %systemroot%\One-Week.bat
@Echo @Set Date1="" >> %systemroot%\One-Week.bat
@Echo @For /f "tokens=2,3 delims=; " %%%%a in ('Date /T') do Set Date1=%%%%a >> %systemroot%\One-Week.bat
@Echo @Echo %%Date1%% >> %systemroot%\One-Week.bat
@Echo @If %%Date1%% EQU 星期日 ( Goto WZ ) Else ( Goto CY ) >> %systemroot%\One-Week.bat
@Echo.>> %systemroot%\One-Week.bat
@Echo :WZ >> %systemroot%\One-Week.bat
@Echo @Set A=Date /t >> %systemroot%\One-Week.bat
@Echo @Echo A >> %systemroot%\One-Week.bat
@Echo @Del I:\Data.Ren.bkf >> %systemroot%\One-Week.bat
@Echo @Echo.^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-Week.bat
@Echo @Echo 星期备份名称变更 %%Date%% 时间 %%Time%% 位置 I:\DATA.Backup.bkf ^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-Week.bat
@Echo @Ren I:\DATA.Backup.bkf Data.Ren.bkf >> %systemroot%\One-Week.bat
@Echo @Echo 星期备份删除成功 %%Date%% 时间 %%Time%% 位置 I:\DATA.Backup.bkf ^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-Week.bat
@Echo @Timeout 600 >> %systemroot%\One-Week.bat
@Echo @Echo 星期完整备份开始 %%Date%% 时间 %%Time%% 位置 I:\DATA.Backup.bkf ^>^> C:\one-week.wz.txt >> %systemroot%\One-Week.bat
@Echo @Echo.^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-Week.bat
@Echo @Echo 星期完整备份开始 %%Date%% 时间 %%Time%% 位置 I:\DATA.Backup.bkf ^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-Week.bat
@Echo @Call %%systemroot%%\pskill server_startup.exe >> %systemroot%\One-Week.bat
@Echo @Call %%systemroot%%\devcon disable *DEV_1648* >> %systemroot%\One-Week.bat
@Echo @Call Schtasks.exe /run /tn "WZ" >> %systemroot%\One-Week.bat
@Echo @Call %%systemroot%%\RTime1.bat >> %systemroot%\One-Week.bat
@Echo @Exit >> %systemroot%\One-Week.bat
@Echo.>> %systemroot%\One-Week.bat
@Echo :CY >> %systemroot%\One-Week.bat
@Echo @Timeout 600 >> %systemroot%\One-Week.bat
@Echo @Set A=Date /t >> %systemroot%\One-Week.bat
@Echo @Echo A >> %systemroot%\One-Week.bat
@Echo @Echo 星期差异备份开始 %%Date%% 时间 %%Time%% 位置 I:\DATA.Backup.bkf ^>^> C:\one-week.cy.txt >> %systemroot%\One-Week.bat
@Echo @Echo.^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-Week.bat
@Echo @Echo 星期差异备份开始 %%Date%% 时间 %%Time%% 位置 I:\DATA.Backup.bkf ^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-Week.bat
@Echo @Call %%systemroot%%\pskill server_startup.exe >> %systemroot%\One-Week.bat
@Echo @Call %%systemroot%%\devcon disable *DEV_1648* >> %systemroot%\One-Week.bat
@Echo @Call Schtasks.exe /run /tn "CY" >> %systemroot%\One-Week.bat
@Echo @Call %%Systemroot%%\RTime1.bat >> %systemroot%\One-Week.bat
@Echo @Exit >> %systemroot%\One-Week.bat
@Echo.>> %systemroot%\One-Week.bat
@Echo :END >> %systemroot%\One-Week.bat
@Echo @Call %systemroot%\One-Month.bat >> %systemroot%\One-Week.bat
@Echo @Exit >> %systemroot%\One-Week.bat
@Goto One-Month
REM :: 一个月备份
:One-Month
@Echo @Echo Off >> %systemroot%\One-Month.bat
@Echo.>> %systemroot%\One-Month.bat
@Echo :One-Month >> %systemroot%\One-Month.bat
@Echo @Set Date1="" >> %systemroot%\One-Month.bat
@Echo @For /f "tokens=3 delims=- " %%%%a in ('Date /T') do Set Date1=%%%%a >> %systemroot%\One-Month.bat
@Echo @Echo %%Date1%% >> %systemroot%\One-Month.bat
@Echo @If %%Date1%% EQU 01 ( Goto WZ ) Else ( Goto CY ) >> %systemroot%\One-Month.bat
@Echo.>> %systemroot%\One-Month.bat
@Echo :WZ >> %systemroot%\One-Month.bat
@Echo @Set A=Date /t >> %systemroot%\One-Month.bat
@Echo @Echo A >> %systemroot%\One-Month.bat
@Echo @Del G:\Data.Ren.bkf >> %systemroot%\One-Month.bat
@Echo @Echo.^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-month.bat
@Echo @Echo 每月备份变更名称 %%Date%% 时间 %%Time%% 位置 G:\DATA.Backup.bkf ^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-month.bat
@Echo @Ren G:\DATA.Backup.bkf Data.Ren.bkf >> %systemroot%\One-Month.bat
@Echo @Echo 每月备份删除成功 %%Date%% 时间 %%Time%% 位置 G:\DATA.Backup.bkf ^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-month.bat
@Echo @Timeout 600 >> %systemroot%\One-Month.bat
@Echo @Echo.^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-month.bat
@Echo @Echo 每月完整备份开始 %%Date%% 时间 %%Time%% 位置 G:\DATA.Backup.bkf ^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-month.bat
@Echo @Call %%systemroot%%\pskill server_startup.exe >> %systemroot%\One-Month.bat
@Echo @Call %%systemroot%%\devcon disable *DEV_1648* >> %systemroot%\One-Month.bat
@Echo @Call Schtasks.exe /run /tn "Month-WZ" >> %systemroot%\One-Month.bat
@Echo @Call %%systemroot%%\RTime.bat >> %systemroot%\One-Month.bat
@Echo @Goto End >> %systemroot%\One-Month.bat
@Echo.>> %systemroot%\One-Month.bat
@Echo :CY >> %systemroot%\One-Month.bat
@Echo @Timeout 600 >> %systemroot%\One-Month.bat
@Echo @Set A=Date /t >> %systemroot%\One-Month.bat
@Echo @Echo A >> %systemroot%\One-Month.bat
@Echo @Echo 每月差异备份开始 %%Date%% 时间 %%Time%% 位置 G:\DATA.Backup.bkf ^>^> C:\one-month.cy.txt >> %systemroot%\One-month.bat
@Echo @Echo.^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-month.bat
@Echo @Echo 每月完差异份开始 %%Date%% 时间 %%Time%% 位置 G:\DATA.Backup.bkf ^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-month.bat
@Echo @Call %%systemroot%%\pskill server_startup.exe >> %systemroot%\One-Month.bat
@Echo @Call %%systemroot%%\devcon disable *DEV_1648* >> %systemroot%\One-Month.bat
@Echo @Call Schtasks.exe /run /tn "Month-CY" >> %systemroot%\One-Month.bat
@Echo @Call %%systemroot%%\RTime.bat >> %systemroot%\One-Month.bat
@Echo @Goto End >> %systemroot%\One-Month.bat
@Echo.>> %systemroot%\One-Month.bat
@Echo :END >> %systemroot%\One-Month.bat
@Echo @Exit >> %systemroot%\One-Month.bat
@Goto End
:End
@Call %systemroot%\One-Week.bat
@Exit
结果
星期差异备份开始 2007-09-07 星期五 时间 9:15:49.08 位置 I:\DATA.Backup.bkf
备份完成 2007-09-07 星期五 时间 9:15:52.14
每月完差异份开始 2007-09-07 星期五 时间 9:15:53.05 位置 G:\DATA.Backup.bkf
备份完成 2007-09-07 星期五 时间 9:15:54.58
2
@Echo Off
@Title 脚本窗口,请勿关闭.谢谢!
@Setlocal,EnableDelayedExpansion&color 0a
@mode con: cols=64 lines=15
@CLS
@Call %systemroot%\devcon enable *DEV_1648*
@COPY C:\数据服务器备份详细日志.txt D:\Domain.Datas\EFS-域用户目录 /Y
@del %systemroot%\RTime1.bat
@del %systemroot%\RTime.bat
@del %systemroot%\Ok1.bat
@del %systemroot%\Ok.bat
@del %systemroot%\Shutdown1.vbs
@del %systemroot%\Shutdown.vbs
@del %systemroot%\One-Week.bat
@del %systemroot%\One-Month.bat
:RTime1
@Echo @Echo Off >> %systemroot%\RTime1.bat
@Echo @Title 六合烘焙.管理脚本 网络系统管理员:小生 联系内线:801 QQ:2302929 >> %systemroot%\RTime1.bat
@Echo @Color 17 >> %systemroot%\RTime1.bat
@Echo @Timeout 60 >> %systemroot%\RTime1.bat
@Echo @Call %%systemroot%%\shutdown1.vbs >> %systemroot%\RTime1.bat
@Echo @Exit >> %systemroot%\RTime1.bat
@Goto Rtime
:RTime
@Echo @Echo Off >> %systemroot%\RTime.bat
@Echo @Title 六合烘焙.管理脚本 网络系统管理员:小生 联系内线:801 QQ:2302929 >> %systemroot%\RTime.bat
@Echo @Color 17 >> %systemroot%\RTime.bat
@Echo @Timeout 60 >> %systemroot%\RTime.bat
@Echo @Call %%systemroot%%\shutdown.vbs >> %systemroot%\RTime.bat
@Echo @Exit >> %systemroot%\Rtime.bat
@Goto Ok1
:OK1
@Echo @Echo Off >> %systemroot%\Ok1.bat
@Echo @Title 六合烘焙.管理脚本 网络系统管理员:小生 联系内线:801 QQ:2302929 >> %systemroot%\Ok1.bat
@Echo @Color 17 >> %systemroot%\Ok1.bat
@Echo @Set A=Date /t >> %systemroot%\Ok1.bat
@Echo @Echo A >> %systemroot%\Ok1.bat
@Echo @Set B=Time /t >> %systemroot%\Ok1.bat
@Echo @Echo B >> %systemroot%\Ok1.bat
@Echo @Echo 备份完成 %%Date%% 时间 %%Time%% ^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\Ok1.bat
@Echo @Call %%systemroot%%\One-Month.bat >> %systemroot%\Ok1.bat
@Echo @Exit >> %systemroot%\Ok1.bat
@Goto Ok
:OK
@Echo @Echo Off >> %systemroot%\Ok.bat
@Echo @Title 六合烘焙.管理脚本 网络系统管理员:小生 联系内线:801 QQ:2302929 >> %systemroot%\Ok.bat
@Echo @Color 17 >> %systemroot%\Ok.bat
@Echo @Set A=Date /t >> %systemroot%\Ok.bat
@Echo @Echo A >> %systemroot%\Ok.bat
@Echo @Set B=Time /t >> %systemroot%\Ok.bat
@Echo @Echo B >> %systemroot%\Ok.bat
@Echo @Echo 备份完成 %%Date%% 时间 %%Time%% ^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\Ok.bat
@Echo @Call %%systemroot%%\devcon enable *DEV_1648* >> %systemroot%\Ok.bat
@Echo @Call Shutdown.exe -f -s -t 600 >> %systemroot%\Ok.bat
@Echo @Exit >> %systemroot%\ok.bat
@Goto Shutdown1
:Shutdown1
@Echo strComputer = "." >> %systemroot%\Shutdown1.vbs
@Echo Set objWMIService = GetObject("winmgmts:\\" ^& strComputer ^& "\root\cimv2") >> %systemroot%\Shutdown1.vbs
@Echo Set colProcesses = objWMIService.ExecQuery("Select * from Win32_Process") >> %systemroot%\Shutdown1.vbs
@Echo For Each objProcess in colProcesses >> %systemroot%\Shutdown1.vbs
@Echo If Right(objProcess.Name, 12) = "ntbackup.exe" Then >> %systemroot%\Shutdown1.vbs
@Echo Set objShell = CreateObject("WScript.Shell") >> %systemroot%\Shutdown1.vbs
@Echo objShell.Run "%%systemroot%%\RTime1.bat" >> %systemroot%\Shutdown1.vbs
@Echo Wscript.Quit >> %systemroot%\Shutdown1.vbs
@Echo End If >> %systemroot%\Shutdown1.vbs
@Echo Next >> %systemroot%\Shutdown1.vbs
@Echo Set objShell = CreateObject("WScript.Shell") >> %systemroot%\Shutdown1.vbs
@Echo objShell.Run "%%systemroot%%\Ok1.bat" >> %systemroot%\Shutdown1.vbs
@Echo Wscript.Quit >> %systemroot%\Shutdown1.vbs
@Goto Shutdown
:Shutdown
@Echo strComputer = "." >> %systemroot%\Shutdown.vbs
@Echo Set objWMIService = GetObject("winmgmts:\\" ^& strComputer ^& "\root\cimv2") >> %systemroot%\Shutdown.vbs
@Echo Set colProcesses = objWMIService.ExecQuery("Select * from Win32_Process") >> %systemroot%\Shutdown.vbs
@Echo For Each objProcess in colProcesses >> %systemroot%\Shutdown.vbs
@Echo If Right(objProcess.Name, 12) = "ntbackup.exe" Then >> %systemroot%\Shutdown.vbs
@Echo Set objShell = CreateObject("WScript.Shell") >> %systemroot%\Shutdown.vbs
@Echo objShell.Run "%%systemroot%%\RTime.bat" >> %systemroot%\Shutdown.vbs
@Echo Wscript.Quit >> %systemroot%\Shutdown.vbs
@Echo End If >> %systemroot%\Shutdown.vbs
@Echo Next >> %systemroot%\Shutdown.vbs
@Echo Set objShell = CreateObject("WScript.Shell") >> %systemroot%\Shutdown.vbs
@Echo objShell.Run "%%systemroot%%\Ok.bat" >> %systemroot%\Shutdown.vbs
@Echo Wscript.Quit >> %systemroot%\Shutdown.vbs
@Goto One-Week
REM :: 一星期备份
:One-Week
@Echo @Echo Off >> %systemroot%\One-Week.bat
@Echo @Title 六合烘焙.管理脚本 网络系统管理员:小生 联系内线:801 QQ:2302929 >> %systemroot%\One-Week.bat
@Echo @Color 17 >> %systemroot%\One-Week.bat
@Echo.>> %systemroot%\One-Week.bat
@Echo :Week7 >> %systemroot%\One-Week.bat
@Echo @Set Date1="" >> %systemroot%\One-Week.bat
@Echo @For /f "tokens=2,3 delims=; " %%%%a in ('Date /T') do Set Date1=%%%%a >> %systemroot%\One-Week.bat
@Echo @Echo %%Date1%% >> %systemroot%\One-Week.bat
@Echo @If %%Date1%% EQU 星期日 ( Goto WZ ) Else ( Goto CY ) >> %systemroot%\One-Week.bat
@Echo.>> %systemroot%\One-Week.bat
@Echo :WZ >> %systemroot%\One-Week.bat
@Echo @Set A=Date /t >> %systemroot%\One-Week.bat
@Echo @Echo A >> %systemroot%\One-Week.bat
@Echo @Set B=Time /t >> %systemroot%\One-Week.bat
@Echo @Echo B >> %systemroot%\One-Week.bat
@Echo @Del I:\Data.Ren.bkf >> %systemroot%\One-Week.bat
@Echo @Echo.^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-Week.bat
@Echo @Echo 星期备份名称变更 %%Date%% 时间 %%Time%% 位置 I:\DATA.Backup.bkf ^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-Week.bat
@Echo @Ren I:\DATA.Backup.bkf Data.Ren.bkf >> %systemroot%\One-Week.bat
@Echo @Echo 星期备份删除成功 %%Date%% 时间 %%Time%% 位置 I:\DATA.Backup.bkf ^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-Week.bat
@Echo @Call Net Send * 通知:DATA服务器10-15分钟后(21:00)开始进行数据备份,届时将中断DATA网络连接,请立即退出并保存已打开数据及退出晋业客户端。谢谢! >> %systemroot%\One-Week.bat
@Echo @Call Net Send 192.168.0.8 通知:'Data.Ren.bkf'完成! >> %systemroot%\One-Week.bat
@Echo @Timeout 600 >> %systemroot%\One-Week.bat
@Echo @Echo 星期完整备份开始 %%Date%% 时间 %%Time%% 位置 I:\DATA.Backup.bkf ^>^> C:\one-week.wz.txt >> %systemroot%\One-Week.bat
@Echo @Echo.^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-Week.bat
@Echo @Echo 星期完整备份开始 %%Date%% 时间 %%Time%% 位置 I:\DATA.Backup.bkf ^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-Week.bat
@Echo @Call %%systemroot%%\pskill server_startup.exe >> %systemroot%\One-Week.bat
@Echo @Call %%systemroot%%\devcon disable *DEV_1648* >> %systemroot%\One-Week.bat
@Echo @Call Schtasks.exe /run /tn "WZ" >> %systemroot%\One-Week.bat
@Echo @Call %%systemroot%%\RTime1.bat >> %systemroot%\One-Week.bat
@Echo @Exit >> %systemroot%\One-Week.bat
@Echo.>> %systemroot%\One-Week.bat
@Echo :CY >> %systemroot%\One-Week.bat
@Echo @Call Net Send * 通知:DATA服务器10分钟后(21:00)开始进行数据备份,届时将中断DATA网络连接,请立即退出并保存已打开数据及退出晋业客户端。谢谢! >> %systemroot%\One-Week.bat
@Echo @Timeout 600 >> %systemroot%\One-Week.bat
@Echo @Set A=Date /t >> %systemroot%\One-Week.bat
@Echo @Echo A >> %systemroot%\One-Week.bat
@Echo @Set B=Time /t >> %systemroot%\One-Week.bat
@Echo @Echo B >> %systemroot%\One-Week.bat
@Echo @Echo 星期差异备份开始 %%Date%% 时间 %%Time%% 位置 I:\DATA.Backup.bkf ^>^> C:\one-week.cy.txt >> %systemroot%\One-Week.bat
@Echo @Echo.^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-Week.bat
@Echo @Echo 星期差异备份开始 %%Date%% 时间 %%Time%% 位置 I:\DATA.Backup.bkf ^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-Week.bat
@Echo @Call %%systemroot%%\pskill server_startup.exe >> %systemroot%\One-Week.bat
@Echo @Call %%systemroot%%\devcon disable *DEV_1648* >> %systemroot%\One-Week.bat
@Echo @Call Schtasks.exe /run /tn "CY" >> %systemroot%\One-Week.bat
@Echo @Call %%Systemroot%%\RTime1.bat >> %systemroot%\One-Week.bat
@Echo @Exit >> %systemroot%\One-Week.bat
@Echo.>> %systemroot%\One-Week.bat
@Echo :END >> %systemroot%\One-Week.bat
@Echo @Call %systemroot%\One-Month.bat >> %systemroot%\One-Week.bat
@Echo @Exit >> %systemroot%\One-Week.bat
@Goto One-Month
REM :: 一个月备份
:One-Month
@Echo @Echo Off >> %systemroot%\One-Month.bat
@Echo @Title 六合烘焙.管理脚本 网络系统管理员:小生 联系内线:801 QQ:2302929 >> %systemroot%\One-Month.bat
@Echo @Color 17 >> %systemroot%\One-Month.bat
@Echo.>> %systemroot%\One-Month.bat
@Echo :One-Month >> %systemroot%\One-Month.bat
@Echo @Set Date1="" >> %systemroot%\One-Month.bat
@Echo @For /f "tokens=3 delims=- " %%%%a in ('Date /T') do Set Date1=%%%%a >> %systemroot%\One-Month.bat
@Echo @Echo %%Date1%% >> %systemroot%\One-Month.bat
@Echo @If %%Date1%% EQU 01 ( Goto WZ ) Else ( Goto CY ) >> %systemroot%\One-Month.bat
@Echo.>> %systemroot%\One-Month.bat
@Echo :WZ >> %systemroot%\One-Month.bat
@Echo @Set A=Date /t >> %systemroot%\One-Month.bat
@Echo @Echo A >> %systemroot%\One-Month.bat
@Echo @Set B=Time /t >> %systemroot%\One-Month.bat
@Echo @Echo B >> %systemroot%\One-Month.bat
@Echo @Del G:\Data.Ren.bkf >> %systemroot%\One-Month.bat
@Echo @Echo.^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-month.bat
@Echo @Echo 每月备份变更名称 %%Date%% 时间 %%Time%% 位置 G:\DATA.Backup.bkf ^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-month.bat
@Echo @Ren G:\DATA.Backup.bkf Data.Ren.bkf >> %systemroot%\One-Month.bat
@Echo @Echo 每月备份删除成功 %%Date%% 时间 %%Time%% 位置 G:\DATA.Backup.bkf ^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-month.bat
@Echo @Call Net Send * 通知:DATA服务器10-15分钟后(21:00)开始进行数据备份,届时将中断DATA网络连接,请立即退出并保存已打开数据及退出晋业客户端。谢谢! >> %systemroot%\One-Month.bat
@Echo @Call Net Send 192.168.0.8 通知:'Data.Ren.bkf'完成! >> %systemroot%\One-Month.bat
@Echo @Timeout 600 >> %systemroot%\One-Month.bat
@Echo @Echo.^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-month.bat
@Echo @Echo 每月完整备份开始 %%Date%% 时间 %%Time%% 位置 G:\DATA.Backup.bkf ^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-month.bat
@Echo @Call %%systemroot%%\pskill server_startup.exe >> %systemroot%\One-Month.bat
@Echo @Call %%systemroot%%\devcon disable *DEV_1648* >> %systemroot%\One-Month.bat
@Echo @Call Schtasks.exe /run /tn "Month-WZ" >> %systemroot%\One-Month.bat
@Echo @Call %%systemroot%%\RTime.bat >> %systemroot%\One-Month.bat
@Echo @Goto End >> %systemroot%\One-Month.bat
@Echo.>> %systemroot%\One-Month.bat
@Echo :CY >> %systemroot%\One-Month.bat
@Echo @Call Net Send * 通知:DATA服务器10分钟后(21:00)开始进行数据备份,届时将中断DATA网络连接,请立即退出并保存已打开数据及退出晋业客户端。谢谢! >> %systemroot%\One-Month.bat
@Echo @Timeout 600 >> %systemroot%\One-Month.bat
@Echo @Set A=Date /t >> %systemroot%\One-Month.bat
@Echo @Echo A >> %systemroot%\One-Month.bat
@Echo @Set B=Time /t >> %systemroot%\One-Month.bat
@Echo @Echo B >> %systemroot%\One-Month.bat
@Echo @Echo 每月差异备份开始 %%Date%% 时间 %%Time%% 位置 G:\DATA.Backup.bkf ^>^> C:\one-month.cy.txt >> %systemroot%\One-month.bat
@Echo @Echo.^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-month.bat
@Echo @Echo 每月完差异份开始 %%Date%% 时间 %%Time%% 位置 G:\DATA.Backup.bkf ^>^> c:\数据服务器备份详细日志.txt >> %systemroot%\One-month.bat
@Echo @Call %%systemroot%%\pskill server_startup.exe >> %systemroot%\One-Month.bat
@Echo @Call %%systemroot%%\devcon disable *DEV_1648* >> %systemroot%\One-Month.bat
@Echo @Call Schtasks.exe /run /tn "Month-CY" >> %systemroot%\One-Month.bat
@Echo @Call %%systemroot%%\RTime.bat >> %systemroot%\One-Month.bat
@Echo @Goto End >> %systemroot%\One-Month.bat
@Echo.>> %systemroot%\One-Month.bat
@Echo :END >> %systemroot%\One-Month.bat
@Echo @Exit >> %systemroot%\One-Month.bat
@Goto Begin-Power
:Begin-Power
@Echo %Time% > %systemroot%\rtime.txt
@Copy Nul %systemroot%\Clinet-Power.txt
@Copy Nul %systemroot%\Power-Server-Shutdown.txt
@Set Time=""
@For /f "tokens=1 delims=; " %%a in ('Time /t') do Set Time=%%a
@If %Time% LSS 18:00 ( Goto go ) else ( Goto clinet )
:go
@For /L %%a in (20,1,100) do ping -n 1 -l 16 -w 100 192.168.0.%%a | find "Reply" >> %systemroot%\Clinet-Power.txt
@For %%a in (%systemroot%\Clinet-Power.txt) do @if "%%~za"=="0" Goto Power-Server-Shutdown
@Goto Time
:Time
@Timeout 60
@Goto Begin-Power
:Power-Server-Shutdown
@For /L %%a in (1,1,20) do ping -n 1 -l 16 -w 100 192.168.0.%%a | find "Reply" >> %systemroot%\Power-Server-Shutdown.txt
@For /F " tokens=12,3 delims=: " %%a in (%systemroot%\Power-Server-Shutdown.txt) do call shutdown -m \\%%a -f -s -t 3
@Goto clinet
:Clinet
@Set Time=""
@For /F "Tokens=1" %%a in ('Time /t') Do set Time=%%a
@Echo %Time%
@If %Time% GEQ 20:45 ( Goto Clinet-Shutdown ) Else ( Goto Clinet-RTime )
:Clinet-RTime
@Timeout 60
@Goto Clinet
:Clinet-Shutdown
@Call Net Send * 系统自动通知信息:您好,系统将在10分钟后强制关闭!请立即保存资料!!!!谢谢!!!
@Copy Nul %systemroot%\Clinet-shutdown.txt
@For /L %%a in (21,1,100) do ping -n 1 -l 16 -w 100 192.168.0.%%a | find "Reply" >> %systemroot%\Clinet-shutdown.txt
@For /F " tokens=12,3 delims=: " %%a in (%systemroot%\Clinet-shutdown.txt) do call shutdown.exe -m \\%%a -f -s -t 600
@Goto Server
:Server
@Set Time=""
@For /F "Tokens=1" %%a in ('Time /t') Do set Time=%%a
@Echo %Time%
@If %Time% GEQ 20:55 ( Goto Server-Shutdown ) Else ( Goto Server-RTime )
:Server-RTime
@Timeout 60
@Goto Server
:Server-shutdown
@Copy Nul %systemroot%\Server-shutdown.txt
@For /L %%a in (3,1,4) do ping -n 1 -l 16 -w 100 192.168.0.%%a | find "Reply" >> %systemroot%\Server-shutdown.txt
@For /L %%a in (6,1,20) do ping -n 1 -l 16 -w 100 192.168.0.%%a | find "Reply" >> %systemroot%\Server-shutdown.txt
@For /F " tokens=12,3 delims=: " %%a in (%systemroot%\Server-shutdown.txt) do call shutdown.exe -m \\%%a -f -s -t 600
@Goto Data-Copy
:DATA-COPY
@Set Date=""
@For /f "tokens=2,3 delims=; " %%a in ('Date /T') do Set Date=%%a
@Echo %Date%
@If %Date% EQU 星期日 ( Goto Time-Copy ) Else ( Goto End )
:Time-Copy
@Set Time=""
@For /f "tokens=1 delims=; " %%a in ('Time /t') do Set Time=%%a
@If %Time% GEQ 12:30 ( Goto Copy ) else ( Goto Copy-Rtime )
:Copy-Rtime
@Timeout 60
@Goto DATA-Copy
:Copy
@Set A=Date /t
@Echo A
@Set B=Time /t
@Echo B
@Copy I:\DATA.Backup.bkf F: /Y
@Net Send 192.168.0.8 一星期数据复制完成
@Echo.>> c:\数据服务器备份详细日志.txt
@Echo 一星期数据备份复制完成 %date% + %Time% + 位置 F:\ >> c:\数据服务器备份详细日志.txt
@Goto End
:End
@Call %systemroot%\One-Week.bat
@Exit
结果
星期差异备份开始 星期四 时间 20:55 位置 I:\DATA.Backup.bkf
备份完成 星期四 时间 20:55
每月完差异份开始 星期四 时间 20:55 位置 G:\DATA.Backup.bkf
备份完成 星期四 时间 20:55
[ Last edited by leton on 2007-9-7 at 09:40 AM ]
|
|