Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Is NT 2000 Dos Batch Timestamp sysntax different ?
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
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
:: ------------------------------------------------------------------ :Get_Time :: ------------------------------------------------------------------ :: Generic time parser
set hh=%%a set mn=%%b set ss=%%c set ds=%%d
![]() |
![]() |