I have been trying to replace a part of some file names in a directory to new names. I have found many examples regarding this replacement using REN
command with a for loop.
Example: if I want to replace test001 to test003, I can replace using REN
.
But what,if I take 001 and 003 as user input through set \p
command and I want the output to be test003, for the input test001.
I have the following files in my folder:
Test001.txt
user001.txt
fjkdjdl001.txt
I want to convert them to
Test0003.txt
user003.txt
and so on.
But 001,003 are user inputted.
How for+ren act with user inputted characters.Please help me.
Often times you do need a small batch script to execute some seemingly simple rename operations. However, you only need the REN command in this case.
ren *001.txt *03.txt
See How does the Windows RENAME command interpret wildcards? for an explanation as to why this works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With