Hi ta all,
I need
to read simultialy from two files
example :
one from par1 and one from par2
for /f %%i in (par1 ) do (
echo ------ %%i ------
)
for /f %%z in (par2) do (
echo ++++++ %%z ++++++
)
thanks .
read simultialy from two files
Moderator: DosItHelp
-
- Posts: 319
- Joined: 12 May 2006 01:13
assuming your files are of the same number of lines, here's a vbscript
output
Code: Select all
Set objFS = CreateObject("Scripting.FileSystemObject")
strFile1 = "c:\test\file.txt"
strFile2 = "c:\test\file2.txt"
Set objFile1 = objFS.OpenTextFile(strFile1)
Set objFile2 = objFS.OpenTextFile(strFile2)
Do Until objFile1.AtEndOfLine
strLine1 = objFile1.ReadLine
strLine2 = objFile2.ReadLine
WScript.Echo strLine1 & "->" & strLine2
Loop
objFile1.Close
objFile2.Close
output
Code: Select all
C:\test>more file1.txt
1
2
3
4
C:\test>more file2.txt
a
b
c
d
C:\test>cscript /nologo test.vbs
1->a
2->b
3->c
4->d
-
- Expert
- Posts: 391
- Joined: 19 Mar 2009 08:47
- Location: Iowa