Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I know basic stuff about batches but not too much about passing variables. So, here's my problem. There are files named file.001, file.002, etc. I am extracting one line out of each text files. With this line, I have to take the dollar amount and record count out of it and echo it into a text file. Here's what I have.
for /f "tokens=1-3 delims=:" %%A in ('findstr /b 2330 h:\dnload\file.*') do (call :Split %%C)
...
:Split
set All=%1
set Dollar=%All:~33,9%
set Record=%All:~25,9%
if %Dollar:~0,1% gtr 0 (set Dollar=$%Dollar:~0,1%,%Dollar:~2,3%,%Dollar:~5,3%.%Dollar:~7,3%) else (set Dollar=$%Dollar:~1,3%,%Dollar:~4,3%.%Dollar:~7,2%)
if %Record:~0,1% gtr 0 (set Record=%Record:~0,1%,%Record:~1,3%) else (set Record=%Record:~1,3%)
echo Record Count: %Record% Dollar Amount: %Dollar% >> c:\docume~1\%username%\desktop\test.txtWhen I do this I get the error:
1Dollar:~0 was unexpected at this timeEven if I set All=%%C before the call split I get the same error.
Any suggestions. Thanks.

Just try, as explanation is too long to post, replace
set All=%1
with
set All=%*
and if that does not work, then try
Set All=%*
Set All=%All: =0%As I said, just try...

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |