I tried to rename some files. But for some reason the first file will be renamed doubled.
%foldername%
is a dynamic variable coming from a file path.
for %%a in (*.txt) do ren "%%a" "%foldername%_%%a"
Input:
newscript1.txt
newscript2.txt
newscript3.txt
Output:
foldername_foldername_newscript1.txt
foldername_newscript2.txt
foldername_newscript3.txt
Any ideas why the loop is doing two times for only the first file? Thanks for answers!