windows - for command is executed only for the first value when a label is inside -


i have script

for /f "delims=" %%i in ('dir "%folder%*.txt" /b /s') (     set s=%%i     set s=!s:%folder%=!     set new_s=!s:\=!     if "x!new_s!" neq "x!s!" (         :processlistsource         /f "tokens=1* delims=\" %%a in ("!s!") (             if "%%a" neq "" (                  if "!folder1!" neq "" (                     set folder1=!folder1!\!name!                 )else (                     set folder1=!name!                 )                 set name=%%a             )             if "%%b" neq "" (                 set s=%%b                 goto :processlistsource             )         )         echo folder is: !folder1!         echo name is: !name!         echo ---------------------     ) else (         echo not folder !s!     ) ) 

but not work have expected: first executed once , last echo printed on screen.

given folder need files subfolders without given folder , split them folder , file

ex: folder=c:\test

the give me file c:\test\test1\test2\t.txt

and need test1\test2 , t.txt

goto breaks for /f \ if context , can executed once.

more simple example:

@echo off  /l %%s in (1=1=5) (     echo %%s     goto :inner_label     rem     :inner_label     rem  ) 

this print 1 . need goto here?


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -