2
I am trying to extract the last word of a findstr results query
The command I run
findstr /i %1 x:\itlogs\who_when.txt | findstr /i %2
the results I get
12/02/2018 10:17:58 SmithS Steve Smith B0K9VY1
13/02/2018 09:29:13 SmithS Steve Smith B0K9VY1
What I need from the results is that last word B0K9VY1 so i can run SCCM RemoteControl $computername
(it will always be the last word on the last line of the results from my findstr
query)
Worked well thanks. How do i filter it to only the very last entry? Currently it is listing every line (but only the machine name now which is great) – Chris Page – 2018-02-13T23:17:10.457
@ChrisPage So you only want the last word on the last line? Move
echo !last_word!
outside of the for loop. And replace theecho
withSCCM RemoteControl
– DavidPostill – 2018-02-13T23:25:29.370