Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

The difference between delims and tokens and asterisks


May 22, 2021 DOS Command learning manual





Compare the difference in execution results between the following two pieces of code:


1、

@echo off

for /f "delims=" %%i in (test.txt) do echo /%%i/

pause


2、

@echo off

for /f "tokens=*" %%i in (test.txt) do echo /%%i/

pause


The .txt content is: abc . There are several spaces at the top of the line.



See the difference?


Why: "delims" means to cancel the default separator, so the contents of the line are copyed down, while "tokens" means getting everything on the line, but ignoring all spaces at the top of the line.


—— namejm