1.

Solve : multiple questions?

Answer»

i want to find a file, eg number1.txt , but i do not know the directory it is in or the file name except i do know the EXTENSION. then i want to copy and rename one file with the found files name and place it in the same directory as the one I was looking for, overwriting the ORIGINAL file. i would also like this to work for multiple files, so that num1.txt, num2.txt and num3.txt would be REPLACED by test.txt, but test.txt would be called num1.txt, num2.txt and num3.txt. if num2.txt and num3.txt were in subdirectories of num1.txt, i would like the replacement test.txt to go in their directories, rather than in num1.txt's directory
so to write it how I think it should go, %%A being the filename, %%B being the directory it is located in
Code: [Select]SET B=(PATH ;)
FOR /d %%A IN (*.txt) DO COPY /y /b C:\test.txt C:\%%B\%%A.txt unfortunatly for me, you cant use commands in the SET command, like waht is written in the code box above. Is there any other way of doing this? Or, more aprropriatly, can this be done by dos at all, without user input?



Discussion

No Comment Found