JadeKnight
IS-IT--Management
I'm creating a script wich is going to read some variables from a txt file. To make the script even more usefull, I want to include computer variables in the text file. Making vbscript expand these.
However, I'm a bit stuck on how I should parse the txt string. I think this should be done in a loop, because it's impossible to know how many computer variables wich will be used in value of variable. Any help would be appreciated.
Here's what I've played with :
Code above is a tmp sample, but it illustrates my point... After assigning the value to sLocalStore, how can I parse the string, and successfully manage to use : ExpandEnvironmentStrings with all variables in string.
However, I'm a bit stuck on how I should parse the txt string. I think this should be done in a loop, because it's impossible to know how many computer variables wich will be used in value of variable. Any help would be appreciated.
Here's what I've played with :
Code:
sLocalStore = ""
sLine = "sLocalStore=%ProgramFiles%\somepath\%computername%"
If Left(sLine, InStr(sLine, "=") -1) = sLocalStore Then
sLocalStore = Mid(sLine, InStr(sLine, "=") +1) '%ProgramFiles%\somepath\%computername% assigned to sLocalStore
End If
'What now?
Code above is a tmp sample, but it illustrates my point... After assigning the value to sLocalStore, how can I parse the string, and successfully manage to use : ExpandEnvironmentStrings with all variables in string.