Jump to content


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.


vbscript help please

  • Please log in to reply
1 reply to this topic

#1 gabzas331


  • Members
  • 18 posts
  • Gender:Male
  • Location:UK
  • Local time:04:05 AM

Posted 18 July 2010 - 05:18 AM

Set objFSO = CreateObject("Scripting.FileSystemObject")

If objFSO.FileExists("C:\Users\debra\Documents\HiMum.txt") Then
	Wscript.Echo "The file does not exist. File will now be created."
End If
now the problem with this is i want it to create the file and add text to it if it doesn't exist.
any ideas?

PS my name isn't debra i'm using my mums laptop

BC AdBot (Login to Remove)


#2 Romeo29


    Learning To Bleep

  • Members
  • 3,194 posts
  • Gender:Not Telling
  • Location:
  • Local time:11:05 PM

Posted 18 July 2010 - 05:50 AM

You already have FileSystemObject in objFSO

to create a file use Set objFile = objFSO.CreateTextFile("C:\Users\debra\Documents\HiMum.txt");
to write data to this file use objFile.WriteLine("Hello, World");
to close the file use objFile.Close();

For more information, you have to check out MSDN : http://msdn.microsoft.com/en-us/library/cz...v=VS.85%29.aspx

Edited by Romeo29, 18 July 2010 - 05:52 AM.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users