ITPub博客

首页 > Linux操作系统 > Linux操作系统 > AUTOEXP腳本

AUTOEXP腳本

原创 Linux操作系统 作者:wwd_wang 时间:2009-01-16 14:41:43 0 删除 编辑

:: ------------------------------------------------------------------
:: Batchfile : NewDate.bat
:: Purpose   : A routine to parse the current date. Supports formats:
::             MM-DD-YYYY  DD-MM-YYYY  DD.MM.YYYY  DD/MM/YYYY
:: OS        : Windows 95+, Windows NT4+
:: Created   : Tom Lavedas <lavedas@pressroom.com>, 20000717
:: Adopted   : Frank-Peter Schultze <fpschultze@bigfoot.de>, 20000719
:: Revised   : Frank-Peter Schultze <fpschultze@bigfoot.de>, 20050918
:: ------------------------------------------------------------------
  @echo off
   if %1/==:/ goto %2
   if NOT %1/==/?/ goto Begin
   echo Parses the current date.
   echo.
   echo [CALL] NewDate
   echo.
   echo NewDate sets the following variables:
   echo.
   echo   Day of Week : DOW
   echo   Day         : DD
   echo   Month       : MM
   echo   Year        : YYYY
   echo.
   echo NewDate supports the following date formats:
   echo.
   echo   MM-DD-YYYY  DD-MM-YYYY  DD.MM.YYYY  DD/MM/YYYY
   for %%C in (echo. goto:End) do %%C
  :Begin --------------------------------------------------------------
   echo. | date | FIND "(mm" > NUL
   if NOT errorlevel 1 %0 : %OS%Parse MM DD
                       %0 : %OS%Parse DD MM
  :Windows_NTParse ----------------------------------------------------
   for /F "tokens=1-4 delims=/.- " %%A in ('date /T') do if %%D!==! (
     set %3=%%A&set %4=%%B&set YYYY=%%C
   ) else (
     set DOW=%%A&set %3=%%B&set %4=%%C&set YYYY=%%D)
   goto End
  :Parse --------------------------------------------------------------
   for %%C in (md cd) do %%C @tmp@
   echo @prompt set _D=$D$_> ~tmp1.bat
   %COMSPEC% /e:2048 /c ~tmp1.bat > ~tmp2.bat
   call ~tmp2
   echo %_D% | FIND "/" > NUL
   if NOT errorlevel 1 goto Slash
   lfnfor on > "%_D%.-"
   ren "%_D%.-" "??? ?? ?? ????"
   for %%F in ("??? ?? ?? ????") do set _D=%%F
   lfnfor off
  :Slash
   echo set DOW=%%%3%%>~tmp1.bat
   for %%S in ("%3=%%%4%%" "%4=%%YYYY%%" "YYYY=%%1") do echo set %%S>>~tmp1.bat
   for %%S in (%_D%) do call ~tmp1 %%S
   echo %_D% | FIND "/" > NUL
   if errorlevel 1 goto Cleanup
   echo @prompt set %4=$%%%4%%$_set YYYY=$%YYYY%$_ > ~tmp1.bat
   %COMSPEC% /e:2048 /c ~tmp1.bat > ~tmp2.bat
   call ~tmp2
  :Cleanup
   for %%C in ("set _D=" cd.. "deltree /y @tmp@ > NUL") do %%C
  :End ----------------------------------------------------------------
rem   echo Demo: YYYY=%YYYY% MM=%MM% DD=%DD% DOW=%DOW%
rem
rem
del /q E:\orabak\nowbackup\*.*
exp system/system buffer=10000000 file=E:\orabak\nowbackup\%DOW%%DD%%MM%.dmp log=E:\orabak\nowbackup\%DOW%%DD%%MM%.log full=y
rar a -ad E:\orabak\nowbackup\%DOW%%DD%%MM%.dmp.rar E:\orabak\nowbackup\%DOW%%DD%%MM%.dmp
copy E:\orabak\nowbackup\*.log E:\orabak\historybackup
copy E:\orabak\nowbackup\*.rar E:\orabak\historybackup

 

 


  

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12137615/viewspace-539823/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-05-08

  • 博文量
    236
  • 访问量
    195560