Jump to content
Sign in to follow this  

read file line vbs

Recommended Posts


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 Artistshttp://kirkhamsebooks.com/MartialArts/Bloc...tterEbook_m.htm

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.