Sign in to follow this  
Followers 0

read file line vbs

3 posts in this topic

Anyone know how to read a file line in vbs? I don't even understand how to open the file yet.

I need it for an autoitx project and autoitx cannot read file lines only ini's


Only $2.00 with Resale Rights How to Block Better for Martial Artists and NonMartial Artists

Share this post

Link to post
Share on other sites

Here is some sample code:

Dim fso, f1, f2, s

file1 = "C:\WSH\testfile.txt"

file2 = "C:\WSH\@ph\testfile.txt"

file3 = "C:\WSH\testfile2.txt"

Set fso = CreateObject("Scripting.FileSystemObject")

Set f1 = fso.CreateTextFile(file1, True)

WScript.StdOut.Writeline "Writing file"

' Write a line.

f1.Write ("This is a test.")

' Close the file to writing.


WScript.StdOut.WriteLine "Moving file to c:\tmp"

' Get a handle to the file.

Set f2 = fso.GetFile(file1)

' Move the file.

f2.Move (File2)

WScript.StdOut.WriteLine "Copying file to c:\temp"

' Copy the file to \temp.

f2.Copy (file3)

WScript.StdOut.WriteLine "Deleting files"

' Get handles to files' current location.

Set f2 = fso.GetFile(file2)

Set f3 = fso.GetFile(file3)

' Delete the files.



WScript.StdOut.WriteLine "All done!"

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0