Windows batch to add prefix to file names, why added twice?
/f
removes the issue of recapturing an existing file:
FOR /f "delims=" %%F IN ('DIR /a-d /b *.pdf') DO (RENAME "%%F" "hello%%F")
@echo offecho.echo. Add Whatever Prefix...echo.echo. You Want To Add...echo.echo. To The Filename...echo.set /p variable=" > "setlocal enabledelayedexpansionfor /f "delims=" %%a in (' dir /b /a-d *.pdf') do ( set oldName=%%a Set newName=%variable%!oldName! Ren "!oldName!" "!newName!")exit
This works well..... Try It Out ... No Double Prefix... Ever.