Bat file Replace text if its not correct

September 3, 2015 at 07:08:33
Specs: Windows 7
I have a folder named c:\Ed inside the folder is a file called coms.cfg on line 7 SerialPort2=1 sometimes this gets changed to SerialPort2=0

I need a script that will ask the user to make sure they run another file before running this batch file and if line 7 is correct SerialPort2=1 to contact support

See More: Bat file Replace text if its not correct

Report •

September 4, 2015 at 17:25:06
Does whatever uses the cfg file need to rewrite it or make changes? If not maybe you can just set the read attribute of the file to 'read only' to keep it from being changed.

For anything else this thread probably ought to be moved to Programming.

Report •

September 6, 2015 at 04:55:56

Long time

I guess this moved here from DOS


M2 Get custom script or take private lessons

Report •

September 6, 2015 at 14:49:36
Hey, I thought you were still around here.

Yeah it was sitting over there for awhile. I don't do much with batch files anyway.

Report •

Related Solutions

September 10, 2015 at 09:53:13
It does need to be written too I deleted this post before I posted in the right place don't know why it didn't delete.

Report •

September 10, 2015 at 22:51:44
The original posting must have been moved and not deleted since my # 1 is still there. If you made a second posting on the same subject it may have been deleted.

You can't use the 'read only' attribute then. You may need to post back the entire file so people will know the details. Then hopefully others with better batch file experience than me will post in.

Report •

Ask Question