Batch file script

Hewlett-packard / Nas
January 15, 2009 at 05:27:51
Specs: Windows XP, Due Core2
Hi Guys,

I am suppose to modify a batch files script but I am having a lot of problems in getting it to work can someone please advise on how to modify the script
@echo off
FOR /F "usebackq eol=; tokens=2,3* delims=/ " %%i in (`date /t`) do set day=%%i
FOR /F "usebackq eol=; tokens=3,4* delims=/ " %%i in (`date /t`) do set month=%%i
FOR /F "usebackq eol=; tokens=4,5* delims=/ " %%i in (`date /t`) do set year=%%i
set Resultscount=0
set itt=1
set SearchResultslog=\\asp2nas01\logs\error_check\%year%_%month%_%day%_Search.log
Echo 1. Start Search
Echo 2. 1 (currently %day%-%month%-%year%)
Echo 3. Enter Value
Echo 4. Quit
set /p job=Select a Task:
if %job%==1 set task=check
if %job%==1 goto next
if %job%==2 goto setdate
if %job%==3 goto value
if %job%==4 goto end

if %itt%==1 set server=asp2app01
if %itt%==2 set server=asp2app02
if %itt%==3 set server=asp2app03
if %itt%==4 set server=asp2app04
if %itt%==5 set server=asp2app05
if %itt%==6 set server=asp2app06
if %itt%==7 set server=asp2app07
if %itt%==8 set server=asp2app08
if %itt%==9 set server=asp2app09
if %itt%==10 set server=asp2app10
if %itt%==11 goto SearchResultslog
goto %task%
FOR /F "usebackq eol=; tokens=3,4* delims=: " %%i in (`find /C "%year%-%month%-%day%" \\%server%\c$\progra~1\archive\3.0\log\System.log`) do set value=%%i
echo %server% had %%value Results:>>%SearchResultslog%
find "%%value-%-%year%-%month%-%day%" \\%server%\c$\progra~1\archive\3.0\log\system.log>>%SearchResultslog%
echo %server% %value%
set /A itt=%ITT%+1
set /A Searches found=%Resultscount%+%value%
goto next

set /p Value=Enter Value:
goto settask

set /p day=Enter Day:
set /p month=Enter Month:
set /p year=Enter Year:
goto settask

if %Resultscount% neq 0 Echo Found %Resultscount% Searches, loading %errorlog%.
if %Resultscount% neq 0 call notepad %errorlog%
goto settask

See More: Batch file script

Report •

January 15, 2009 at 05:46:50
Sorry I forgot to include my description of what I am trying to do, anyway here it is:

I have multiple folders on a shared server and these folders have error logs which get generated every 15 to 20 mins depending on the size of the log file.
Now when the logs are generated they are saved by the date and time and then at the end it will have error log for example:

So what I am trying to do is to modify this script to allow me to enter a specific string that i am looking for in all the logs on all the multiple folders but also at the same time allow me restrict my search to the date I set it to so I will end up haveing to hold 2 variables one for teh date and one for the string then output the results to a notepad.

Report •

January 18, 2009 at 15:47:48
Can anyone help please?

Report •

Related Solutions

Ask Question