指令是这样:
For /f "delims=, tokens=1" %a in (.\test.txt) do @if exist %a echo %a
text.txt的内容类似这样:
HashMyFiles.cfg,b64024e1b47393606d62c64e7546ae56,,,,,,C:\Dropbox\
HashMyFiles.chm,ee90eae5744b57ef24e8d4f2f42de4b7,,,,,,C:\Dropbox\
输出的内容会是这样:
HashMyFiles.cfg
HashMyFiles.chm
但用:
For /f "delims=, tokens=2" %a in (.\test.txt) do @if exist %a echo %a
这样的时候就不会有内容
但用:
For /f "delims=, tokens=3" %a in (.\test.txt) do @if exist %a echo %a
又可以正确得到:
C:\Dropbox\
C:\Dropbox\
想请问为什么tokens=2的时候反而无法显示?