Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: SOME1 find error in my code plz  (Read 2474 times)

0 Members and 1 Guest are viewing this topic.

rusban

  • Guest
SOME1 find error in my code plz
« on: February 06, 2009, 12:26:20 AM »
Hi! I have problem with my code:
@echo off
for /f "tokens=*" %%I in ('dir /b /s /a-d "C:\bat"') do (
set /p choice="%%~nI"
echo.
echo file %choice%
echo.
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
SET J=-1
SET T="%%~nI"
:STRLEN_LOOP
SET /A J += 1
IF NOT "!T!" == "" IF NOT "!T!" == "!T:~0,%J%!" (
    GOTO :STRLEN_LOOP
)
SET /A J -= 2
ENDLOCAL & SET RESULT=%J%
echo bukv %result%

)
pause

This code  find  files with lenght of file name ==5 in some folder.
But For don't work here( Program takes just 1 file( from folder(
I think where  are some problem here:
:STRLEN_LOOP
SET /A J += 1
IF NOT "!T!" == "" IF NOT "!T!" == "!T:~0,%J%!" (
    GOTO :STRLEN_LOOP
)
because without it all works perfect...
Can someone help me plz?
And sorry for my bad language cos i'm from RUSSIA...
« Last Edit: February 06, 2009, 08:26:59 AM by rusban »