You need to change tokens to 1-2
You need to write the right var
You need to echo %%b
SET BASES_NAMES=Base1,Base2
FOR /F "tokens=1-2 delims=," %%a IN ("%BASES_NAMES%") DO (
ECHO Valeur: %%a
ECHO Valeur: %%b
)
%%a = Base1
%%b = Base2
Search found 3 matches
- 11 Jun 2010 05:55
- Forum: DOS Batch Forum
- Topic: String split with separaotr
- Replies: 3
- Views: 5107
- 02 Jun 2010 06:46
- Forum: DOS Batch Forum
- Topic: Sum output from file?
- Replies: 2
- Views: 3779
Re: Sum output from file?
Try this: set /A tot=0 for /f "tokens=1" %%a in (file.txt) do ( set /A tot+=%%a ) echo %tot% otherwise the variable %tot% will not be changed during the run tim of the for loop. echo %var% and echo.%var% is allmost the same. If var is not defined (has no value) you will get a message if y...
- 02 Jun 2010 05:00
- Forum: DOS Batch Forum
- Topic: Sum output from file?
- Replies: 2
- Views: 3779
Sum output from file?
Hello, I need to sum the output from a file, why this doesnt work i dont know? set /A tot=0 for /f "tokens=1" %%a in (file.txt) do ( set /A tot=%tot% + %%a ) echo %tot% The file looks like this: 5 3 8 6 4 8 The %tot% variable is equal to the last value in the file? Anyone knows why? EDIT: ...