Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBS Script that will Open and Edit a file

Status
Not open for further replies.

hariKara

Technical User
Jul 25, 2012
1
GB
Hi All Scripters.

Im very new to scripting and wanted to know if someone could help me out. I need to run a VBS script as follows:

1. Search for a particular file (variable.txt)
2. If the file is present open it and add some text to the document (Eg. "Text Added"), save the file and close it.
3. If the file that is searched for does not exists then create new file called variable.txt, add some different text (Eg. "New File"), save and close this file.

I hope someone can help me out here.

Thanks in advance.

Hari
 
Have a look at the FileSystemObject and the "OpenTextFile" method with option "ForAppending".

Cheers,
MakeItSo

“Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.” (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top