Batch file to output last line of findstr

前端 未结 2 1638
一整个雨季
一整个雨季 2021-01-27 01:26

I am trying to find a list of machines in files in folders, and print out the last line of the output only.

@echo off
for /f %%a in (computers.txt) do findstr /x         


        
2条回答
  •  伪装坚强ぢ
    2021-01-27 02:11

    @echo off
    setlocal enableextensions disabledelayedexpansion
    for /f %%a in (computers.txt) do (
        set "line="
        for /f "tokens=*" %%b in ('findstr /xs "%%a" *') do set "line=%%b"
        setlocal enabledelayedexpansion
        echo(!line!
        endlocal
    )
    pause
    endlocal
    

提交回复
热议问题