fso

Read line per line a txt file with VBS

痞子三分冷 提交于 2019-11-29 04:05:52
I'm trying this code: filename = "test.txt" listFile = fso.OpenTextFile(filename).ReadAll listLines = Split(listFile, vbCrLf) For Each line In listLines WScript.Echo line 'My Stuff Next Or this other: filename = "test.txt" Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile(filename, ForReading) Do Until f.AtEndOfStream myLine = f.ReadLine WScript.Echo myLine 'My Stuff Loop Why in both cases it echoes all lines at once, and of course I'm unable to work line by line? Any idea? Ekkehard.Horner Your file has funny EndOfLine markers. Let's assume the lines are terminated

Access files with long paths (over 260)

两盒软妹~` 提交于 2019-11-28 00:37:09
问题 I'm using Microsoft Scripting Runtime (FSO) to parse folders and produce a list of all of its contents, the folders are on a network and resultant paths end up longer than 260. The minimum code I have is as below:- Private Sub ProcessFolder(ByVal StrFolder As String) Dim Fl As File Dim Fldr As Folder Dim RootFldr As Folder Set RootFldr = FS.GetFolder(StrFolder) For Each Fl In RootFldr.Files Debug.Print Fl.Path Next For Each Fldr In RootFldr.SubFolders DoEvents ProcessFolder Fldr.Path Next Set

Read line per line a txt file with VBS

微笑、不失礼 提交于 2019-11-27 18:00:56
问题 I'm trying this code: filename = "test.txt" listFile = fso.OpenTextFile(filename).ReadAll listLines = Split(listFile, vbCrLf) For Each line In listLines WScript.Echo line 'My Stuff Next Or this other: filename = "test.txt" Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile(filename, ForReading) Do Until f.AtEndOfStream myLine = f.ReadLine WScript.Echo myLine 'My Stuff Loop Why in both cases it echoes all lines at once, and of course I'm unable to work line by line?

Using VBA to get extended file attributes

妖精的绣舞 提交于 2019-11-26 04:50:45
问题 Trying to use Excel VBA to capture all the file attributes from files on disk , including extended attributes. Was able to get it to loop through the files and capture the basic attributes (that come from the file system): File Path File Name File Size Date Created Date Last Accessed Date Last Modified File Type Would also like to capture the extended properties that come from the file itself: Author Keywords Comments Last Author Category Subject And other properties which are visible when