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.

Generic User Avatar

Asking for Help with VBS Script


  • Please log in to reply
1 reply to this topic

#1 Lobol

Lobol

  •  Avatar image
  • Members
  • 22 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Bavaria, Germany
  • Local time:10:50 PM

Posted 06 June 2021 - 10:09 AM

Hello,

 

I wanted to write a simple VBS Script, that reads through every line of a .txt file, searches for a word, then creates a new .txt file and writes in there every line that

 

contains that word.

 

I wrote a script which has runned without producing an error message, but it created no new file. So I tried to create that new empty file manually and hoped it would

 

write then in there, but it didn't.

 

Then I wrote another script which creates that new file, but I was not sure how to implement there for what it shall look for and write in the new file.

 

Obviously my problem is, how to merge the two scripts in a working manner.

 

But, when I'm already asking here for help, I would expand my expectations what the script should do:

 

Ideally it should search for a word in every text line and if it finds it, search for 3 other strings, then list in the new file all lines with the word and the first string, create a

 

second file where it lists the lines with the word and the second string and in a third file the same for the third string.

 

I will attach the two scripts I have written, so you can see what I've done until and hopefully somebody will help me.

 

That would be very nice and I thank everyone who has read until here!

 

 

Best Regards and Greetings from Germany,

 

Lobol

 

EDIT: Obviously I can't attach a .vbs file. So I copy the contents and paste it into .txt files and attach them.

Attached Files



BC AdBot (Login to Remove)

 


#2 SamHobbs

SamHobbs

  •  Avatar image
  • Members
  • 84 posts
  • OFFLINE
  •  
  • Local time:01:50 PM

Posted 17 July 2022 - 03:28 PM

I suggest solving just portions of the requirements first and asking for help if you need help with just a portion.

 

I think you are saying you need to read a file, process it then write a new file. You can start by writing a script that just copies a file; just reads a file and writes the contents to a new file. There are probably samples of doing that. If you need help with that then you could link to the sample and ask for help.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users