

InterviewSolution
1. |
Solve : for command question? |
Answer» This SEEMS to simple to be asking for help but here goes, help! What am I missing that won't allow the for command to capture the entire line past the space character? You are mistaken in thinking that tokens=1 will compress the whole line into the %%A metavariable. What the tokens=1 element does is take the line up to the first delimiter and put that first token into the EXPLICIT FOR metavariable (%%A in this case). If there were more tokens specified by numbers they would (assuming they were present in the line) be assigned to implicit metavariables starting with the next letter of the alphabet in the same case (here, %%B). Spaces and tabs are the fault delimiters if no other(s) is (are) specified using delims=. If you want to get the whole line into %%A you need to specify that the delimiter is the end of the line. That is, delims= followed by the closing double quote of the options BLOCK. You can do so like this FOR /F "usebackq delims=" %%A IN (C:\temp\file_path.txt) DO ( By the way, in the filespec there needs to be a colon after the drive letter. You are using usebackq when you don't need to. Thanks. That did it. |
|