Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Batch file to edit files
Name: alytech Date: August 30, 2008 at 20:32:30 Pacific OS: 2k, XP CPU/Ram: 1Gb Product: IBM
Comment:
Hi, for work im trying to create a batch file that edits 2 files Definfo.dat and Usage.dat in the following manner.
The file definfo.dat contains the following lines
[Curdefs]=20080718.003 [Lastdefs]=20080717.025
I need the batch file to change the value in [Curdefs]=20080718.003 to 20080717.025 as in [Lastdefs]
Also it needs it to check Usage.dat to see if the value 20080718.003 exists and to change it to 20080717.025.
The values shown here are just examples and can change from on PC to another
Name: Mechanix2Go Date: August 31, 2008 at 00:52:37 Pacific
Reply:
" The values shown here are just examples and can change from on PC to another
"
So, to generalize, you need to change the [Curdefs]= value to the [Lastdefs]= value, right?
===================================== If at first you don't succeed, you're about average.
M2
0
Response Number 2
Name: alytech Date: August 31, 2008 at 04:39:42 Pacific
Reply:
Correct
0
Response Number 3
Name: ghostdog Date: August 31, 2008 at 05:08:33 Pacific
Reply:
here's a vbscript
Set objFS = CreateObject("Scripting.FileSystemObject") Const ForReading = 1 Set objFile = objFS.OpenTextFile("c:\test\test.txt", ForReading, True) ReadAllTextFile = objFile.ReadAll arrAll = Split(ReadAllTextFile,vbCrLf) For i = LBound(arrAll) To UBound(arrAll) If InStr(arrAll(i),"Lastdefs") > 0 Then arrLastDef = Split(arrAll(i),"=") arrCurDef = Split(arrAll(i-1),"=") arrCurDef(1)=arrLastDef(1) arrCurDef = Join(arrCurDef,"=") arrAll(i-1) = arrCurDef End If Next For i = LBound(arrAll) To UBound(arrAll) WScript.Echo arrAll(i) Next
Summary: I have a demo CD that I want to give out to people. It's an HTML using MS agent. The voice for the character animation is stored in numerous WAV files. In working with agent technology, there are no...
Summary: Also it might help if I told you that the batch program actually creates this text file that I am trying to edit, so maybe if I am lucky it could be done in one step. I guess it might be easier to if ...
Summary: Hello I am trying to create a batch file that will "add" a line to my hosts file so that our server can resolve. Since it will be for more then just me I want to make sure that the batch file creates ...