Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
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