Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

VBS WriteLine


  • Please log in to reply

#1
IO-error

IO-error

    Member

  • Member
  • PipPipPip
  • 276 posts
Hi there.
I'm going to do a workshop on school that explains VBS. I'm using only notepad and common sence, so no nifty program.

What I planned to show the students is a script that updates a textfile in it's directory.

The whole program will write a registry key to the register in silence mode under the hash of
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\
If you add a key there (ending with .exe), and fill in the path, you can type that word at the Run dialog and the path is booted. It's a handy program, but I lost track of how many custom stuff I added to the registry, so I want the script to keep a track of it's adds.
So how do I let the script add a new line in the textfile with a new added key.

This is what I got concerning the part in question.
Set Txt = FSO.OpenTextFile("Added keys.txt", 2, True)
Txt.Writeline (""&Key)

I understand that changing the 2 to a 1 only limits the textfile to be read and making it an 8, will make it available for appending. Appending is adding, but what else do I have to add to the writeline-code to put the new lines on the bottom of the file?

Thanks in advance.
  • 0

Advertisements


#2
IO-error

IO-error

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 276 posts
Hm, it seems that giving the Appending number is enough.
I tried it before, but it didn't work.
Well, anyway, this is how to do the trick.

Set Txt = FSO.OpenTextFile("Added keys.txt", 8, True)
Txt.Writeline (""&Key)

  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP