Name: ashlesha Date: May 14, 2005 at 02:19:16 Pacific Subject: Find and Replace in Batch files OS: WIndows XP /DOS CPU/Ram: Pentium 4- 504MB RAM
Comment:
Hi, I want to create a file to do the following: 1. Create multiple copies of a folder and rename them in a numerically ascending order. 2. Open a specific file from the folder and change some of the contents. 3. save the changed file. 4. repeat actions 2 and 3 for all the copies. However, the changes in their individual files will be different for each folder.
I think i can do the first step. However, i cant find a command to find and Replace the text in a file. I can use the findstr "string" path:filename cmd to find the required string, but how do i replace it?
1 - You cannot create multiple copies of a folder unless there in different folders. Your best method is to create the folders in one folder then copy the files. i.e. md dir01 md diro2 md dir03 ... md dirnn copy dirxx\*.* dir01 copy dirxx\*.* dir02 copy dirxx\*.* dir03 ... copy dirxx\*.* dirnn
2,3,4 To open, replace, save will require 3rd party software unless the contents is simple enough that it could be created by other means.
I can find text and write the changes back to the original file using the FOR command. but is there a way to delete a particular line in the file? m looking into 3rd party tools.
The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE