Batch scripting find the first occurence of string taskid [duplicate]
问题 This question already has answers here : How can I get unique records from in the below case (1 answer) How to get a particular value from file by batch script? [duplicate] (2 answers) Closed 11 days ago . I have a text file with a string occurs multiple lines. I want to get the line where this is the first occurrence of the string. I could find all occurrences using below command but I want only first occurrence in single line command. findstr /C:"taskId" Book.txt Book.txt 3047 [main] INFO