VBS: assigning the value to variable from a string another file?

There's a text file in a network folder \\ServerShara\1.txt
As the VBS script to take the value of variables for example
strText1 = 1st line from a file 1.txt on a globe, and a variable
strUrl1 = 2nd line from a file 1.txt on the balloon?
is it even possible and how exactly to specify that the variable is equal to the entire first line from a text file?
This is necessary in order not to change every time the script so that the Manager could edit lines in Txt file and the script worked already with the new values.
March 12th 20 at 08:05
1 answer
March 12th 20 at 08:07
Solution
Const ForReading = 1

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("\\ServerShara\1.txt", ForReading)

strText1 = objTextFile.ReadLine
strUrl1 = objTextFile.ReadLine

objTextFile.Close
Thank you very much! I was embarrassed that I didn't understand how to specify line numbers, but it is not necessary and everything works as you wrote the example!! I was certain that with this code and strText1 and strUrl1 will take the same value equal to the 1st line of the txt file, but everything works just fine! thanks again) - caleigh commented on March 12th 20 at 08:10
@caleigh, not for that) - gideon commented on March 12th 20 at 08:13

Find more questions by tags VBScript