tedhome
То же самое, но на VBS:
Код: Const FOR_READING = 1
strPath = Wscript.Arguments(0)
strExt = Wscript.Arguments(1)
strResFile = Wscript.Arguments(2)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objResFile = objFSO.CreateTextFile(strResFile, TRUE)
Set objFolder = objFSO.GetFolder(strPath)
Set colFiles = objFolder.Files
For Each objFile In colFiles
If LCase(Right(objFile.Name, Len(strExt))) = LCase(strExt) Then
objResFile.WriteLine
objResFile.WriteLine("*************************************************************************")
objResFile.WriteLine(objFile.Name)
objResFile.WriteLine
Set objSourceFile = objFSO.OpenTextFile(objFile.Path, FOR_READING)
objResFile.WriteLine(objSourceFile.ReadAll)
objSourceFile.Close
End If
Next
objResFile.Close
То же самое, но на VBS:
Код: Const FOR_READING = 1
strPath = Wscript.Arguments(0)
strExt = Wscript.Arguments(1)
strResFile = Wscript.Arguments(2)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objResFile = objFSO.CreateTextFile(strResFile, TRUE)
Set objFolder = objFSO.GetFolder(strPath)
Set colFiles = objFolder.Files
For Each objFile In colFiles
If LCase(Right(objFile.Name, Len(strExt))) = LCase(strExt) Then
objResFile.WriteLine
objResFile.WriteLine("*************************************************************************")
objResFile.WriteLine(objFile.Name)
objResFile.WriteLine
Set objSourceFile = objFSO.OpenTextFile(objFile.Path, FOR_READING)
objResFile.WriteLine(objSourceFile.ReadAll)
objSourceFile.Close
End If
Next
objResFile.Close