Can't use substring in my batch rename

时间:2015-07-28 15:53:15

标签: batch-file substring rename

I'm trying to batch rename a bunch of files to a portion of their parent folder but I can't seem to extract the part i want from the folder name. Here is what I have:

    @echo off
    for /d /r %CD% %%d in (*) do (
        for /f %%b in ("%%~nxd") do (
        set FULLNAME=%%b
        set FILENAME=%FULLNAME:~9,-7%
            for %%f in ("%%~d\??.json") do ren "%%~f" "%FILENAME%_%%~nxf"
        )
    )

pause

Again, I'm very inexperienced witch batch and I'm probably missing something obvious.

0 个答案:

没有答案