[wpkg-users] [OT] 'for' madness...

Semián Matěj semianm at pokrok.cz
Thu Mar 21 11:50:19 CET 2013


Hi,

  why are you using parameter /d in inner loop? Parameter /R is using 
path set after parameter or pwd to recurse.

As I see it, this could be it:

for %%G in (%APPDATA%\Mozilla\Firefox\Profiles 
%APPDATA%\Thunderbird\Profiles) do (
	echo %%G
         if exist "%%G" (
                 if defined SQLITE (
                         echo %SQLITE%
			pushd %%G
			for /R %%X in (*.sqlite) do (
				echo %SQLITE% "%%X" VACUUM
                       	  	echo %SQLITE% "%%X" REINDEX
                     	)
			popd	
                 )
         )
  )

Dne 21.3.2013 10:58, Marco Gaiarin napsal(a):
>
> I'm trying to build a cmd script, doing what i'm think are simple
> tasks, but i'm hitting some trouble doing a nested 'for'.
>
> Example:
>
>
>   for %%G in (%APPDATA%\Mozilla\Firefox\Profiles %APPDATA%\Thunderbird\Profiles) do (
>          echo %%G
>          if exist "%%G" (
>                  if defined SQLITE (
>                          echo %SQLITE%
>                          for /d /r %%X in (%%G\*.sqlite) do (
>                                  echo %SQLITE% "%%X" VACUUM
>                                  echo %SQLITE% "%%X" REINDEX
>                          )
>                  )
>          )
>   )
>
>
> Inside the first for, 'echo %%G' works, the exist check works, but the
> use of %%G in the second for not, and if i try to define a variable,
> eg:
> 	set test=%%G
>
> %test% is empty.
>
>
> What i'm missing? Thanks.
>

-- 
S pozdravem
Matěj Semián

Stavební bytové družstvo POKROK
Kollárova 157/18, Praha 8
tel. 225 339 402




More information about the wpkg-users mailing list