|OK - A testing environment was created using the following script. The %temp%\trial\ directory is created and files are written to that directory for testing purposes only. This script must be run prior to running the main script otherwise files will not exist.|
if not exist %temp%\trial\ md %temp%\trial\
echo y|del %temp%\trial\*.*
for /l %%1 in (1,1,20) do (
echo >"%temp%\trial\%%1 - file name%%1.ext" ryryryr
Here is the main script with some adjustments to let you see the results. The added commands can be deleted and paths amended if and when you are satisfied with the results. You will appreciate that you did not post the path to the files so the script must be amended by you.
pushd %temp%\trial\||echo Pushd failed - job terminated.&&exit /b
echo.Input filenames are:
for /f "tokens=*" %%1 in ('dir /a-d /b') do (
for /f "tokens=1-2*" %%A in ("%%1") do (
ren "%%1" "%%C"
echo Files renamed to:
dir /b %temp%\trial\
Please come back & tell us if your problem is resolved.