Bill Prew, was kind enough to author a VBScript for me, that deleted a number of line between two comment lines, in a .manifest file.
And it works perfectly.
Now, I need at add 5 lines, to the same .manifest file, in place of the lines that that were deleted.
VBScript that Bill authored looks like this:
' Define needed constants
Const ForReading = 1
Const ForWriting = 2
Const TriStateUseDefault = -2
' Define start and end of comment strings
strCommentStart = "<!-- ======= Start of lines to be deleted =======-->"
strCommentEnd = "<!-- ======= End of lines to be deleted =======-->"
' Get input file name from command line parm, if 2 parms entered
' use second as new output file, else rewrite to input file
If (WScript.Arguments.Count > 0) Then
sInfile = WScript.Arguments(0)
WScript.Echo "No filename specified."
If (WScript.Arguments.Count > 1) Then
sOutfile = WScript.Arguments(1)
sOutfile = sInfile
' Create file system object
Set oFSO = CreateObject("Scripting.Fi
' Read entire input file into a variable and close it
Set oInfile = oFSO.OpenTextFile(sInfile,
ForReading, False, TriStateUseDefault)
sData = oInfile.ReadAll
Set oInfile = Nothing
' Replace desired strings
sData = DoReplace(sData)
' Write file with any changes made
Set oOutfile = oFSO.OpenTextFile(sOutfile
, ForWriting, True)
Set oOutfile = Nothing
' Cleanup and end
Set oFSO = Nothing
' Remove all characters between comment start and end strings
blnDone = False
DoReplace = sData
intOffset = 1
' Loop until no more comments to process
Do While Not blnDone
intStartLeft = Instr(intOffset, DoReplace, strCommentStart, vbTextCompare)
If intStartLeft > 0 Then
intStartRight = intStartLeft + Len(strCommentStart) - 1
intEndLeft = Instr(intStartRight, DoReplace, strCommentEnd, vbTextCompare)
If intEndLeft > 0 Then
intEndRight = intEndLeft + Len(strCommentEnd) - 1
DoReplace = Left(DoReplace, intStartRight) & vbCrLf & Mid(DoReplace, intEndLeft)
intOffset = intEndRight - (intEndLeft - intStartRight - 1) + 2
blnDone = True
blnDone = True
The five lines that I need to add, look like this:
<assemblyIdentity name="BETASys" version="18.104.22.168" type="win32" processorArchitecture="x86
I have uploaded the manifest file, that needs to have the lines deleted from it and the 5 lines added to it.
I would appreciate this very VERY