New
#1
Batch Rename Script Help!
Hello!
I am very new to this and need a little help. I am trying to create a batch file that will rename files that are called png_X.png (the X being the number page it is). The code I have is below. It works fine with out the pipe sort command but it sorts the by the ones place first and then by the tens. I tried putting the pipe sort command in to tell it how to see the file names but it doesn’t run at all with that command. Is my line wrong somehow with the pipe command?
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
set i=1
cd C:\Users\Desktop\Visio Stuff\File Rename\Temp Picture File
for /f %%f in ('dir /b .\ | sort /+10') do (
echo renaming "%%f" to "!i!.jpg"
ren "%%f" "!i!.jpg"
set /A i=!i!+1
)
ENDLOCAL
set "i="