I tried to change names *.txt files, but i have a problem I can't solve. I would like to give prefixes to *.txt files entered by user input, but the code I have adds, without knowing why, a doubled prefix for one file.
@echo off
SET /p Input=Enter prefix wanted:
Echo You entered: "%Input%"
Pause
for %%a in (*.txt) do ren "%%a" "%Input%%%a"
before using the code: 1.txt 2.txt 3.txt
after using the code with prefix added by user: test1.txt test2.txt testest3.txt
Do you know the solution to my problem?