Solved need help with learning batch

November 22, 2012 at 10:35:54
Specs: Windows 7
can someone give me an explanation what (msdos) command for/f Key options
Tokens and delims mean and what they do ?

See More: need help with learning batch

Report •

November 22, 2012 at 10:44:50

That's the first hit on Google. I'm sure you can find more.

Report •

November 22, 2012 at 12:18:24
i saw that but i still :D my english is not so good can someone give my an easier explantion pls

Report •

November 22, 2012 at 16:42:49
✔ Best Answer
delims values specify the character or characters that will be used to "split" a string into tokens. A delimiter is only one byte, but more than one delimiter may be specified for multiple surgeries.
tokens values specify which of the tokens to put into the "for"-loop variables.
for /f "delims=* tokens=1,3" %%a in ("this*is*test")
splits "this*is*test" into three tokens, based on location of delimiter *, but the tokens says only get the first and third, and ignore the second. Tokens assignment to for-loop variables begins with the variable named (in this case, %%a), and successive active, or called-for tokens are assigned in alphabetical order.
Since only two tokens are being activated, in this example, the vars. to receive the values will be %%a and %%b. Note that since token #2 is ignored, it does not occupy a variable. To be sporting, I will let you guess the final result. There are a number of other considerations, such as how null tokens are handled (they are ignored). For /f "delims=* tokens=1,3-4" %%a in ("****first token***x* **fourth")
gives only tokens with non-null values (a space is not a null, it will be assigned.)
The best thing to do is experiment, using the dbl-quoted string syntax (the form that I used in examples), and see what happens when you change the string and the key-parameter specifications.

Report •

Related Solutions

November 23, 2012 at 05:48:34

here is another reference :D

:: mike

Report •

Ask Question