FileSystemObject

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chwy
    New Member
    • Jun 2007
    • 2

    FileSystemObject

    HI All,

    Now i am writing a vbscript using the filesystemobjec t to read the contant line by line of registry file (*.reg). Unfortunally, what the contant that show for the first line is "ypw" and the continuous is empty. Could anyone help? Thanks in advance.


    My code as below:

    [CODE=vb]Set file = CreateObject("S cripting.FileSy stemObject")
    Set mfile = file.OpenTextfi le("c:\registry .reg") 'registry.reg is export from regedit

    While NOT mfile.AtEndOfSt ream
    a=mfile.Readlin e
    msgbox a
    Wend

    mfile.close[/code]
    Last edited by Killer42; Jun 18 '07, 08:32 AM. Reason: Added [CODE=vb] tag
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    You need to specify in the OpenTextFile method that it's a Unicode file. See the format parameter in the documentation for more info, but here's the code...[CODE=vb]Set mfile = File.OpenTextFi le("c:\registry .reg", ForReading, False, TristateTrue)[/CODE]
    Last edited by Killer42; Jun 18 '07, 08:50 AM. Reason: Wrong parameter name

    Comment

    Working...