i’m trying to write a batch file that sets a variable to the first word in a text file.
i can get it to find the first word in the text file using the findstr command, but it outputs the entire line, this is what i have so far:
@echo off
for /f “tokens=*” %%a in (‘findstr /b /i “\<.*\>” “%cd%\somthing.txt”‘) do set a=%%a
echo %a%
pause
but even though it is picking up on the first word, it outputs the whole line, and i can’t find any commands to make it output just the first word.
does anyone have an idea of how to make this output the first word? or possibly even a completely new command to do so. thanks a heap for any suggestions 🙂
1 Answer