What command will make a batch file receive input from a text( .txt) file?
            Asked
            
        
        
            Active
            
        
            Viewed 6,991 times
        
    2 Answers
3
            
            
        Here's a transcript showing a batch file that will do what you want:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Pax> type qq.cmd
@setlocal enableextensions enabledelayedexpansion
@echo off
for /f "delims=" %%a in (%1) do (
    echo.LINE^> %%a
)
endlocal
C:\Pax> type qq.txt
hello
goodbye
C:\Pax> qq qq.txt
LINE> hello
LINE> goodbye
The for statement reads the lines one at a time into the variable %%a (delims= is needed otherwise spaces are used for breaks and you'll only get the first word on each line rather than the whole line.
%1 is the argument passed into the batch file, qq.txt in this case.
Everything else is just support stuff that I use to get the best cmd.exe environment set up.
 
    
    
        paxdiablo
        
- 854,327
- 234
- 1,573
- 1,953
0
            
            
        You can pass the names as parameters and capture them.
Look here for details.
 
    
    
        Community
        
- 1
- 1
 
    
    
        Shamim Hafiz - MSFT
        
- 21,454
- 43
- 116
- 176
