Alternatively, you could use this approach:
@Set "}="&(Set /P "="&Set /P "}=")<"response.csv"&If Not Defined } Echo No Data
The idea is that the variable named }
will be defined with the content of line 2 of response.csv
. If that variable is not defined, it means that there was no content on line 2.
This is a little different to the answer already provided because if the second line was empty, and there was a line 3 with content, it would show as having no data. Therefore this example only reports no data on line 2, not no data beyond line 1.
If you want to report no data beyond line 1, here's another alternative:
findstr /N "^" "response.csv" 2>NUL|findstr /BL "2:">NUL||Echo No Data
Although I'd prefer to use full paths and names:
%SystemRoot%\System32\findstr.exe /N "^" "Response.csv" 2>NUL | %SystemRoot%\System32\findstr.exe /B /L "2:" 1>NUL || Echo No Data