1.

Solve : Convert script from bash to bat?

Answer»

The following is a bash script, launching SpanParser.exe APPLICATION with a capability of parsing any of the mentioned format files (*.pa; *.pa2; *.par; *.PA2; *.lfe; *.EUR)in the C:\xpit.com\applications\SpanParser\data direvtory. Also it creates a log file with the same name as the object file is, in the same directory:
COULD anyone create the same for windows (bat)?

# Script executes the span-parser for SPAN files downloaded
# SETUP the program variables

PARSER='c:/xpit.com/applications/spanparser/spanparser.exe'
DATAPATH='c:/xpit.com/applications/spanparser/data'

# Run the parser on all .PAR, LIFFE and EUREX files
for elem in `ls $DATAPATH/*.[pP][aA][rR23] $DATAPATH/*.eur $DATAPATH/*.lfe`; do
echo ${elem}
$PARSER -nogwl ${elem} > ${elem}.log
done



Perhaps this will help. It may actually work!

Code: [Select]@echo off
rem Script executes the span-parser for SPAN files downloaded
rem Setup the program variables

set PARSER='c:\xpit.com\applications\spanparser\spanparser.exe'
set DATAPATH='c:\xpit.com\applications\spanparser\data'

for %%v in (pa pa2 par lfe eur) do (
for /f "tokens=* delims=" %%w in ('dir %DATAPATH%\*.%%v /B') do (
echo %%v
%PARSER% -nogwl %DATAPATH%\%%w > %DATAPATH%\%%w.log
)
)

Thanks Sidewinder. Actually it didn't exactly work, but still gave a clue on where to approach from. I'll keep working on it based on your script over the week end. I'll post my achievements for you. For Sidewinder:
It turned out to be much more simple then one could think of:

forfiles /p c:\xpit.com\applications\spanparser\data\ /m *.pa2 /c "cmd /c C:\xpit.com\applications\SpanParser\SpanParser.exe -nogwl @path > @path.log"
forfiles /p c:\xpit.com\applications\spanparser\data\ /m *.lfe /c "cmd /c C:\xpit.com\applications\SpanParser\SpanParser.exe -nogwl @path > @path.log"
forfiles /p c:\xpit.com\applications\spanparser\data\ /m *.par /c "cmd /c C:\xpit.com\applications\SpanParser\SpanParser.exe -nogwl @path > @path.log"
forfiles /p c:\xpit.com\applications\spanparser\data\ /m *.eur /c "cmd /c C:\xpit.com\applications\SpanParser\SpanParser.exe -nogwl @path > @path.log"

This serves the purpose.
But anyways thanks a lot for your efforts.



Discussion

No Comment Found