Batch to find log files

April 18, 2011 at 14:32:47
Specs: Windows XP
My prevous batch files created log files for me for referance and assurance purposes, the number of .log files grew so big that I am now making a batch file to find the proper log file but I ran into a bump

@ECHO OFF
SET /p Param=Please enter a shop order number^>
ECHO. %Param%
@echo off
title Wenger Tasks
:home
cls
echo.
echo Select a task:
echo ==============================
echo.
echo 1) Find manual ship date
echo 2) Find translation ship date
echo 3) Find translation receive date
echo 4) View all
echo 0) Exit
echo.
set /p web=Execute Task #:
if "%web%"=="1" start notepad "C:\Batch\Task Log\Ship Log\%Param%*.log"
if "%web%"=="2" start notepad "C:\Batch\Task Log\Translations\Sent\*%Param%*.log"
if "%web%"=="3" start notepad "C:\Batch\Task Log\Translations\Received\%Param%*.log"
if "%web%"=="4" start notepad "C:\Batch\Task Log\Ship Log\%Param%*.log"
if "%web%"=="4" start notepad "C:\Batch\Task Log\Translations\Sent\*%Param%*.log"
if "%web%"=="4" start notepad "C:\Batch\Task Log\Translations\Received\%Param%*.log"
if "%web%"=="0" Exit
Exit

I am pretty sure it has to do with how I finished out the command. There is an example of a few log file names it looks for below.

12878_English_Manuals_Shipped.log
Received_12876_from_translator.log
12872_Sent_out_to_translator.log

%param% is the 5 digit number you see in the log file

I had previously thought that * allows to look for anything but I guess theres a differant way of doing this when dealing with a longer sentance. I can change my .log files around to be more uniform if needed so the %Param% is always in the same place, I just didnt think it mattered. Any help would be greatly appreciated, thanks!


See More: Batch to find log files

Report •


#1
April 18, 2011 at 16:12:42
Why so complex...

@ECHO OFF
SET /p Param=Please enter a shop order number^>
cd\ "C:\Batch\Task Log\"
dir "*%Param%*.log" /s


Report •
Related Solutions


Ask Question