fly Posted March 1, 2006 Posted March 1, 2006 I need to be able to loop through a text file, find a line and replace it. I know that I can use FOR /F, but how do I actually do the compare and replace. Is it possible in a batch file or should I just use VBS?
fly Posted March 1, 2006 Author Posted March 1, 2006 Okay, it was too easy to do it in vbs. Although if someone could explain how to do it in batch, I'd love to hear it.
bledd Posted March 1, 2006 Posted March 1, 2006 this will help you!http://forums.overclockers.co.uk/showthread.php?t=17542405
IcemanND Posted March 1, 2006 Posted March 1, 2006 without using third party software like SED you would use for /f and wite all of the line to another file and do an if statement to look for the line you want to change and replace it when writeing then copy over the original file wh=ith the modified when finished.for /f %%L in (%svcpackdir%\HFINT.DAT) DO (if %%L==mrxsmb.sys.temp ( echo mrxsmb.sys>>%svcpackdir%\HFINT.TMP) ELSE ( echo %%L>>%svcpackdir%\HFINT.TMP))move /y %svcpackdir%\HFINT.TMP %svcpackdir%\HFINT.DAT
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now