vendredi 11 septembre 2015

count length of filenames in batch

my problem is I want to count the length of multiple filenames and save this numbers into a file.

My approach is this:

@echo off
for %%i in (*.txt) do (
    set Datei=%%~ni
    call :strLen Datei strlen

    :strLen
    setlocal enabledelayedexpansion

    :strLen_Loop
    if not "!%1:~%len%!"=="" set /A len+=1 & goto :strLen_Loop
    (endlocal & set %2=%len%)

    echo.%strlen%>> tmp
)

The problem here is it only works for the first filename and after that it is stuck and does not go on to the next filename.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire