Parse same positions each time from filename

June 15, 2010 at 11:36:41
Specs: Windows XP
I'm trying to parse the 20-29 positions from a filename and rename the file using the 20-29 position.

Here's what I've got, but it's not working:

for %%a in (*.pdf) do (

set s=%%~na
set s=%s%:~20,9%
rename %%a %s%

)


See More: Parse same positions each time from filename

Report •


#1
June 15, 2010 at 12:01:33
you need it like this:
...
set s=%%~na
call :xx
)
goto :eof
:xx
set s=%s:~20,9%
rename %%a %s%
::------
or else use enabledelayedexpansion:

setlocal enabledelayedexpansion
...
set s=!s:~20,9!
rename %%a !s!
)


Report •
Related Solutions


Ask Question