General
cancel
Showing results for 
Search instead for 
Did you mean: 

redirect input from file in vbs

kabucek
Advisor

redirect input from file in vbs

hello all,

i have vbs script for searching new files and i use batch to redirect output to a report.txt file
output is one file. -example "today.log"

i want to copy that file to different location.
how is this possible?


thanks
1 REPLY
Change_happens
Honored Contributor

Re: redirect input from file in vbs

Const ForReading = 1
Const ForWriting = 2
i = 1

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\today.log", ForReading)

Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
objFSO.CopyFile strLine , "C:\copied_files\", OverwriteExisting
Loop

This will copy ur all files listed in the log to c:\copied_files folder if i understand ur problem correct?

Thanks,
Ajay
(assign points if it solves ur question :-))