Q:

How to extract a specific line from multiple text file into a single txt file on Windows? 

I have 300 files (.txt) with different name. 
I want 2nd line of each file copied next to its file name into single text file. 
Path of the file is D:\WCR\
Please help me with a script to be created in notepad with .Bat extension or commands to be given in cmd
Early response will be appreciated..!! 

A:

This batch file can be used for this task:
@echo off
setlocal EnableExtensions DisableDelayedExpansion
set "SourceFolder=D:\WCR"
del "%SourceFolder%\SecondLines.log" 2>nul

for %%I in ("%SourceFolder%\*.txt") do call :ProcessFile "%%I"

endlocal
goto :EOF

:ProcessFile
for /F usebackq^ skip^=1^ delims^=^ eol^= %%L in (%1) do (
    >>"%SourceFolder%\SecondLines.log" echo %~nx1: %%L
    goto :EOF
)
goto :EOF

Please note that command FOR ignores always empty lines.  So if the second line is an empty line, the next non empty line is written into the LOG file. 
The log file is created in source directory.  For that reason it is important that the log file has not file extension txt. 
For understanding the used commands and how they work, open a command prompt window, execute there the following commands, and read entirely all help pages displayed for each command very carefully. 

call /? 
del /? 
echo /? 
endlocal /? 
for /? 
goto /? 
set /? 
setlocal /? 

See also:

Where does GOTO :EOF return to? 
How does the Windows Command Interpreter (CMD.EXE) parse scripts? 
Microsoft article about Using command redirection operators

