指令是這樣:
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的時候反而無法顯示?