Computing.Net > Forums > Programming > Batch Help

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch Help

Reply to Message Icon

Name: stroke6463
Date: March 8, 2006 at 09:40:15 Pacific
OS: XP Pro
CPU/Ram: idk
Comment:

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.txt

When I do this I get the error:
1Dollar:~0 was unexpected at this time

Even if I set All=%%C before the call split I get the same error.

Any suggestions. Thanks.



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: March 8, 2006 at 14:34:42 Pacific
Reply:

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...


0
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch Help

XCOPY - Batch Help www.computing.net/answers/programming/xcopy-batch-help/10929.html

Batch help - FTP but code cycles? www.computing.net/answers/programming/batch-help-ftp-but-code-cycles/15651.html

Batch Help www.computing.net/answers/programming/batch-help/5335.html