|1, 2 and 3:|
for /f "tokens=1,2* delims==" %%A in (coms.cfg) do (
Reads the file, putting token 1 into %%A, and the rest after the first delim. (=) in %%B, then executes the code in the DO clause (The clause must be closed with a ")").
Example: If the delim. is ":", then the stuff on before it will become %%A, and the stuff after it will become %%B. If there's an asterisk provided in say "tokens=1,2*" then the second token will contain EVERYTHING after the first delim. regardless of any other colon signs appearing later in the string.
4: If your file contains strings like:
Then the for loop will create a variable called "something" and assign the value "value" to it. Since your file contains either "SerialPort2=1" or "SerialPort2=0", it will create a variable in the script called "SerialPort2" and assign the value provided in the coms.cfg file.
You can read more about FOR in the command prompt. Enter:
Hope this helped
99 little bugs in the code,
99 little bugs.
Take one down, patch it around,
129 little bugs in the code.