The Artima Developer Community
Sponsored Link

Java Answers Forum
Batch File: error SETting a variable within a FOR /F loop

1 reply on 1 page. Most recent reply: May 22, 2008 11:09 PM by random n00b

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
random n00b

Posts: 2
Nickname: randomn00b
Registered: May, 2008

Batch File: error SETting a variable within a FOR /F loop Posted: May 22, 2008 11:04 PM
Reply to this message Reply
Advertisement

FOR /f "tokens=1,2* delims=^" %%1 IN (%remfp%) DO (
ECHO %%2
pause
echo entering process loop2
set /a ydiff=%%2:~6,10%% - %cury%
echo %ydiff%
set /a mdiff=%%2:~3,5%-%curm%
echo %mdiff%
set /a ddiff=%%2:~0,2%-%curd%
echo %ddiff%
)



remfp is a file path.

the variables (i.e. ydiff, mdiff, ddiff) just arent set and i can't figure out why. i mean, the value just doesn't go into the variable. im not sure if this makes sense, but can anyone help me?

if you need clarification, please ask.


random n00b

Posts: 2
Nickname: randomn00b
Registered: May, 2008

Re: Batch File: error SETting a variable within a FOR /F loop Posted: May 22, 2008 11:09 PM
Reply to this message Reply
sorry should be:


FOR /f "tokens=1,2* delims=^" %%1 IN (%remfp%) DO (
ECHO %%2
pause
echo entering process loop2
set /a ydiff=%%2:~6,10%%-%cury%
echo %ydiff%
set /a mdiff=%%2:~3,5%%-%curm%
echo %mdiff%
set /a ddiff=%%2:~0,2%%-%curd%
echo %ddiff%
)


%remfp% is a file with strings and dates
%%2 is the date token
%cury%,%curm%,%curd% are integer strings

Flat View: This topic has 1 reply on 1 page
Topic: Frustating errors while creating java web-service Previous Topic   Next Topic Topic: KnapSack problem

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use