1.

Solve : search + replace batch file help...?

Answer»

I have yet another .BAT question..
Is there a way to scan my C: for say a.txt, and replace all occurences of a.txt with b.txt?
If this is possible, will somebody PLEASE post the code or atleast tell me which commands NEED to be used?

Thanks!I'm not sure we should be encouraging these type of questions which could be classified as borderline destructive.

Quote

...or atleast tell me which commands need to be used

You will need the FOR, DIR, and REN commands.

Good luck, I guess

hwo woudl I use FOR??

(I use DIR and REM, all the time, I've used REN b4 but what about FOR??)
go on. . .Actually, the original post can be interpreted a few WAYS. Does the OP wish to change the name of all the a.txt files to b.txt? OR does the OP wish to change the contents of all the a.txt files with the contents of b.txt?

If it's the former, the original response stands. If it's the latter, you WOULD need the FOR, DIR and COPY commands.

In any case, making mass changes can have far reaching and unpredictable consequences. Enough said.


Discussion

No Comment Found