Script for searching & editing a file
Navigate to C:\test
Open test1.config in Notepad
Search for <test2> After the line that starts <add name="test3"........
insert the following line
<add name="Oracle Data Provider for .NET" invariant="Oracle.DataAccess.Client" description="Oracle Data Provider for .NET" type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=2.102.3.2, Culture=neutral, PublicKeyToken=89b483f429c47342" />
Save the test1.config file.
Open test1.config in Notepad
Search for <test2> After the line that starts <add name="test3"........
insert the following line
<add name="Oracle Data Provider for .NET" invariant="Oracle.DataAccess.Client" description="Oracle Data Provider for .NET" type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=2.102.3.2, Culture=neutral, PublicKeyToken=89b483f429c47342" />
Save the test1.config file.
0 Comments
[ - ] Hide Comments

so that the conversation will remain readable.
Answer this question
or Comment on this question for clarity
Answers
This post ought to be in the 'Scripting' forum, no? I expect one of the moderators will move it.
Anyway, this is an XML file, by the look if it? I have an XML WMC which I've used FOR ONE PURPOSE. I emphasise that because I've not used it in about 3 years and therefore can't vouch for the efficacy of the other functions, nor did I spend a great deal of time working out how to use them.. It should be a trivial task to turn the WSC into a class which you can incorporate into the script.
I've deposited a copy http://senduit.com/b805af here. The link expires in 2 days.
Anyway, this is an XML file, by the look if it? I have an XML WMC which I've used FOR ONE PURPOSE. I emphasise that because I've not used it in about 3 years and therefore can't vouch for the efficacy of the other functions, nor did I spend a great deal of time working out how to use them.. It should be a trivial task to turn the WSC into a class which you can incorporate into the script.
I've deposited a copy http://senduit.com/b805af here. The link expires in 2 days.
Please log in to comment
You Should use a deferred CA that reads the xml file, parametrized with public properties, and once read replace the parameters with the valid information.
On Error Resume Next
Dim WshShell, temp_line
Set WshShell = CreateObject("WScript.shell")
sFileName = path to the file to edit
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(sFileName, 1)
temp_line = objFile.ReadAll
temp_line =replace(temp_line , "text to replace", Session.Property("PROPERTY WHERE IS THE VALID TEXT"))
objFile.Close
Set objFile = objFSO.OpenTextFile(sFileName, 2)
objFile.WriteLine temp_line
objFile.Close
If you have more than one parameter you can set a property with all the Public properties to use separated with "|" and with a split command use in the script.
On Error Resume Next
Dim WshShell, temp_line
Set WshShell = CreateObject("WScript.shell")
sFileName = path to the file to edit
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(sFileName, 1)
temp_line = objFile.ReadAll
temp_line =replace(temp_line , "text to replace", Session.Property("PROPERTY WHERE IS THE VALID TEXT"))
objFile.Close
Set objFile = objFSO.OpenTextFile(sFileName, 2)
objFile.WriteLine temp_line
objFile.Close
If you have more than one parameter you can set a property with all the Public properties to use separated with "|" and with a split command use in the script.
Please log in to comment
ORIGINAL: skjAt a whisker under 12K in size, I doubt I'd be popular with the moderators. I can't email it to you, either, as my current client blocks attachments of this type (and yes, it does *sniff* the contents, so the old renaming tricks won't work.) If you have a site I can upload to, I can do that.
can u pls post that script in this forum, i'm not able to open that site
Please log in to comment
If your environment allows 3rd-party ActiveX controls, you could do worse than this http://www.chilkatsoft.com/xml-activex.asp
I don't know how you might insert the line in the position you want but the docs look pretty thorough.
I don't know how you might insert the line in the position you want but the docs look pretty thorough.
Please log in to comment
Comments