Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Is NT 2000 Dos Batch Timestamp sysntax different ?

Re: Is NT 2000 Dos Batch Timestamp sysntax different ?

From: Garry Deane <garrydeane_at_yahoo.com.au>
Date: Fri, 04 Oct 2002 00:43:39 GMT
Message-ID: <3d9cde8f.2233952@192.168.0.2>


On Thu, 3 Oct 2002 12:54:53 -0700, "Joe Caporina" <spam_at_nospam.com> wrote:

>Why is the batch file that I use with NT 4 server OS to import logs assign
>timestamps to the log not working with NT2000 Server OS?
>The log file does not change names with the date and just gets overwritten.
>cd/d d:\oracle\admin\int2000\script
>setdate >setenv.bat
>call setenv.bat
>call intexp1.bat
>sendmail -t esdbsecurity_at_alliance.com -f parsat01 -s "PARSAT01 CHECK -
>INTELATRAC" -b
>\\parsat01\d$\oracle\admin\int2000\exp\intexp%TODAY%_%HR%_%MIN%.LOG
>

As others have said, you don't need setdate, setenv, intexp etc to get the date into environment variables.

Regardless of that, it is highly likely that one of those batch files is using a variable called DATE and/or TIME. This is OK in NT but problematic in W2k and XP because these variables are set and automatically updated by the system. My guess is that one of the batch programs is referring to %DATE% and/or %TIME% but is getting them in the format produced by the system rather than what the batch file expects.

A quick and dirty fix would be to rename any DATE and TIME variables in these files to something else. A better solution is to use the FOR command to extract what you need from the DATE/T and TIME/T commands.

Below are a couple of generic routines that will do what you want.

Garry

cd/d d:\oracle\admin\int2000\script
sendmail -t esdbsecurity_at_alliance.com -f parsat01 -s "PARSAT01 CHECK -INTELATRAC" -b
call :Get_Date
set today=%yy%%mm%%dd%
call :Get_time
\\parsat01\d$\oracle\admin\int2000\exp\intexp%TODAY%_%HH%_%MN%.LOG goto :eof

:: ------------------------------------------------------------------
:Get_Date
:: ------------------------------------------------------------------
:: Generic date parser
:: Sets %dd% (01-31), %mm% (01-12) & %yy% (4 digit)

if "%date%A" LSS "A" (set toks=1-3) else (set toks=2-4) for /f "tokens=2-4 delims=(-)" %%a in ('echo:^|date') do (   for /f "tokens=%toks% delims=.-/ " %%d in ('date/t') do (

    set %%a=%%d
    set %%b=%%e
    set %%c=%%f

    set toks=
  )
)
if %yy% LSS 100 set yy=20%yy%
goto :eof
:: ------------------------------------------------------------------
:Get_Time
:: ------------------------------------------------------------------
:: Generic time parser

:: Returns time elements as 2 digit values (24 hr clock) :: Sets %hh%, %mn%, %ss% and %ds%
for /f "tokens=5-8 delims=:., " %%a in ('echo:^|time') do (
  set hh=%%a
  set mn=%%b
  set ss=%%c
  set ds=%%d

)
if %hh% LSS 10 set hh=0%hh%
goto :eof Received on Thu Oct 03 2002 - 19:43:39 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US