/build/static/layout/Breadcrumb_cap_w.png

vbscript to edit batch file

looking for vbscript to edit batch file to change values in it.

0 Comments   [ + ] Show comments

Answers (7)

Posted by: murali.bhat 14 years ago
Purple Belt
0
Open the file as text file. Use the REPLACE command to change.

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile (FILE_LOC, 1)
objTextFile.Close
strData = objTextFile .ReadAll
strData = REPLACE (strData, OLD_VALUE,NEW_VALUE)
Set objTextFile = objFSO.OpenTextFile (FILE_LOC, 2)
objTextFile.Writeline strData
objTextFile.Close
Set objFSO = Nothing
Posted by: murali.bhat 14 years ago
Purple Belt
0
Correction.

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile (FILE_LOC, 1)
strData = objTextFile .ReadAll
objTextFile.Close
strData = REPLACE (strData, OLD_VALUE,NEW_VALUE)
Set objTextFile = objFSO.OpenTextFile (FILE_LOC, 2)
objTextFile.Writeline strData
objTextFile.Close
Set objFSO = Nothing
Posted by: er.hsingh 14 years ago
Orange Senior Belt
0
thnx murali.
Posted by: anonymous_9363 14 years ago
Red Belt
0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Why bother? Why not have the VBS do what the BAT is doing?!?

Is it me? Is it? Really?
Posted by: er.hsingh 14 years ago
Orange Senior Belt
0
This file has lot of values written at install time (vendors MSI)
Needed this batch file to be there, vbscript was required to change the values.
Posted by: anonymous_9363 14 years ago
Red Belt
0
Even better! A vendor MSI which writes a batch file. LOL...how do they get away with this cr@p?
Posted by: jmcfadyen 14 years ago
5th Degree Black Belt
0
so vendors still don't seem to know what to do.. sigh didnt we cover this stuff like 5-6 years ago?

you should probably be using CustomActionData in there somewhere as well. If you want to do it properly anyways .
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ